mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.2977: crash when using a null function reference
Problem: Crash when using a null function reference. (Naohiro Ono) Solution: Check for an invalid function name. (closes #8367)
This commit is contained in:
parent
8de901e1f1
commit
22db0d549f
@ -425,3 +425,5 @@ EXTERN char e_nr_arguments_too_few[]
|
|||||||
INIT(= N_("E1190: %d arguments too few"));
|
INIT(= N_("E1190: %d arguments too few"));
|
||||||
EXTERN char e_call_to_function_that_failed_to_compile_str[]
|
EXTERN char e_call_to_function_that_failed_to_compile_str[]
|
||||||
INIT(= N_("E1191: Call to function that failed to compile: %s"));
|
INIT(= N_("E1191: Call to function that failed to compile: %s"));
|
||||||
|
EXTERN char e_empty_function_name[]
|
||||||
|
INIT(= N_("E1192: Empty function name"));
|
||||||
|
@ -3772,7 +3772,14 @@ call_func_rettv(
|
|||||||
s = partial_name(pt);
|
s = partial_name(pt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
s = functv.vval.v_string;
|
s = functv.vval.v_string;
|
||||||
|
if (s == NULL || *s == NUL)
|
||||||
|
{
|
||||||
|
emsg(_(e_empty_function_name));
|
||||||
|
goto theend;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
s = (char_u *)"";
|
s = (char_u *)"";
|
||||||
@ -3786,6 +3793,7 @@ call_func_rettv(
|
|||||||
funcexe.basetv = basetv;
|
funcexe.basetv = basetv;
|
||||||
ret = get_func_tv(s, -1, rettv, arg, evalarg, &funcexe);
|
ret = get_func_tv(s, -1, rettv, arg, evalarg, &funcexe);
|
||||||
|
|
||||||
|
theend:
|
||||||
// Clear the funcref afterwards, so that deleting it while
|
// Clear the funcref afterwards, so that deleting it while
|
||||||
// evaluating the arguments is possible (see test55).
|
// evaluating the arguments is possible (see test55).
|
||||||
if (evaluate)
|
if (evaluate)
|
||||||
|
@ -2174,9 +2174,11 @@ func Test_call()
|
|||||||
call assert_fails("call call('Mylen', [], 0)", 'E715:')
|
call assert_fails("call call('Mylen', [], 0)", 'E715:')
|
||||||
call assert_fails('call foo', 'E107:')
|
call assert_fails('call foo', 'E107:')
|
||||||
|
|
||||||
" This once caused a crash.
|
" These once caused a crash.
|
||||||
call call(test_null_function(), [])
|
call call(test_null_function(), [])
|
||||||
call call(test_null_partial(), [])
|
call call(test_null_partial(), [])
|
||||||
|
call assert_fails('call test_null_function()()', 'E1192:')
|
||||||
|
call assert_fails('call test_null_partial()()', 'E117:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_char2nr()
|
func Test_char2nr()
|
||||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2977,
|
||||||
/**/
|
/**/
|
||||||
2976,
|
2976,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user