patch 9.1.0590: Vim9: crash when accessing getregionpos() return value
Problem: Vim9: crash when accessing getregionpos() return value.
Solution: Correct the return type (zeertzjq).
fixes: #15272
closes: #15273
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/evalfunc.c b/src/evalfunc.c
index a5e4b20..52ac48c 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -1326,7 +1326,6 @@
*decl_type = &t_list_any;
return &t_list_list_any;
}
-
static type_T *
ret_list_string_items(int argcount UNUSED,
type2_T *argtypes UNUSED,
@@ -1336,6 +1335,14 @@
return &t_list_list_string;
}
static type_T *
+ret_list_regionpos(int argcount UNUSED,
+ type2_T *argtypes UNUSED,
+ type_T **decl_type)
+{
+ *decl_type = &t_list_any;
+ return &t_list_list_list_number;
+}
+ static type_T *
ret_dict_any(int argcount UNUSED,
type2_T *argtypes UNUSED,
type_T **decl_type UNUSED)
@@ -1968,11 +1975,11 @@
ret_number, f_diff_hlID},
{"digraph_get", 1, 1, FEARG_1, arg1_string,
ret_string, f_digraph_get},
- {"digraph_getlist",0, 1, FEARG_1, arg1_bool,
+ {"digraph_getlist", 0, 1, FEARG_1, arg1_bool,
ret_list_string_items, f_digraph_getlist},
{"digraph_set", 2, 2, FEARG_1, arg2_string,
ret_bool, f_digraph_set},
- {"digraph_setlist",1, 1, FEARG_1, arg1_list_string,
+ {"digraph_setlist", 1, 1, FEARG_1, arg1_list_string,
ret_bool, f_digraph_setlist},
{"echoraw", 1, 1, FEARG_1, arg1_string,
ret_void, f_echoraw},
@@ -2144,8 +2151,8 @@
ret_dict_any, f_getreginfo},
{"getregion", 2, 3, FEARG_1, arg3_list_list_dict,
ret_list_string, f_getregion},
- {"getregionpos", 2, 3, FEARG_1, arg3_list_list_dict,
- ret_list_string, f_getregionpos},
+ {"getregionpos", 2, 3, FEARG_1, arg3_list_list_dict,
+ ret_list_regionpos, f_getregionpos},
{"getregtype", 0, 1, FEARG_1, arg1_string,
ret_string, f_getregtype},
{"getscriptinfo", 0, 1, 0, arg1_dict_any,