mirror of
https://github.com/neovim/neovim.git
synced 2025-10-03 16:36:30 +00:00
vim-patch:8.2.0896: crash when calling searchcount() with a string
Problem: Crash when calling searchcount() with a string.
Solution: Check the argument is a dict. (closes vim/vim#6192)
14681627f3
This commit is contained in:
@@ -4535,11 +4535,16 @@ void f_searchcount(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argvars[0].v_type != VAR_UNKNOWN) {
|
if (argvars[0].v_type != VAR_UNKNOWN) {
|
||||||
dict_T *dict = argvars[0].vval.v_dict;
|
dict_T *dict;
|
||||||
dictitem_T *di;
|
dictitem_T *di;
|
||||||
listitem_T *li;
|
listitem_T *li;
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
|
||||||
|
if (argvars[0].v_type != VAR_DICT || argvars[0].vval.v_dict == NULL) {
|
||||||
|
EMSG(_(e_dictreq));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dict = argvars[0].vval.v_dict;
|
||||||
di = tv_dict_find(dict, (const char *)"timeout", -1);
|
di = tv_dict_find(dict, (const char *)"timeout", -1);
|
||||||
if (di != NULL) {
|
if (di != NULL) {
|
||||||
timeout = (long)tv_get_number_chk(&di->di_tv, &error);
|
timeout = (long)tv_get_number_chk(&di->di_tv, &error);
|
||||||
|
@@ -259,6 +259,10 @@ func Test_search_stat()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_searchcount_fails()
|
||||||
|
call assert_fails('echo searchcount("boo!")', 'E715:')
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_search_stat_foldopen()
|
func Test_search_stat_foldopen()
|
||||||
CheckScreendump
|
CheckScreendump
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user