forked from aniani/vim
patch 7.4.2233
Problem: Crash when using funcref() with invalid name. (Dominique Pelle) Solution: Check for NULL translated name.
This commit is contained in:
@@ -3587,8 +3587,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref)
|
|||||||
use_string = TRUE;
|
use_string = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((use_string && vim_strchr(s, AUTOLOAD_CHAR) == NULL)
|
if ((use_string && vim_strchr(s, AUTOLOAD_CHAR) == NULL) || is_funcref)
|
||||||
|| is_funcref))
|
|
||||||
{
|
{
|
||||||
name = s;
|
name = s;
|
||||||
trans_name = trans_function_name(&name, FALSE,
|
trans_name = trans_function_name(&name, FALSE,
|
||||||
@@ -3597,7 +3596,8 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref)
|
|||||||
s = NULL;
|
s = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s == NULL || *s == NUL || (use_string && VIM_ISDIGIT(*s)))
|
if (s == NULL || *s == NUL || (use_string && VIM_ISDIGIT(*s))
|
||||||
|
|| (is_funcref && trans_name == NULL))
|
||||||
EMSG2(_(e_invarg2), s);
|
EMSG2(_(e_invarg2), s);
|
||||||
/* Don't check an autoload name for existence here. */
|
/* Don't check an autoload name for existence here. */
|
||||||
else if (trans_name != NULL && (is_funcref
|
else if (trans_name != NULL && (is_funcref
|
||||||
|
@@ -237,6 +237,7 @@ func Test_funcref()
|
|||||||
call assert_equal(1, OneByRef())
|
call assert_equal(1, OneByRef())
|
||||||
let OneByRef = funcref('One')
|
let OneByRef = funcref('One')
|
||||||
call assert_equal(2, OneByRef())
|
call assert_equal(2, OneByRef())
|
||||||
|
call assert_fails('echo funcref("{")', 'E475:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_setmatches()
|
func Test_setmatches()
|
||||||
|
@@ -763,6 +763,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 */
|
||||||
|
/**/
|
||||||
|
2233,
|
||||||
/**/
|
/**/
|
||||||
2232,
|
2232,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user