mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.1789: Vim9: crash with invalid list constant
Problem: Vim9: crash with invalid list constant. (Dhiraj Mishra) Solution: Return FAIL when compiling the list fails. (closes #7066)
This commit is contained in:
parent
016faaa1b2
commit
c1f0066b64
@ -276,4 +276,6 @@ EXTERN char e_final_requires_a_value[]
|
||||
INIT(= N_("E1125: Final requires a value"));
|
||||
EXTERN char e_cannot_use_let_in_vim9_script[]
|
||||
INIT(= N_("E1126: Cannot use :let in Vim9 script"));
|
||||
EXTERN char e_missing_name_after_dot[]
|
||||
INIT(= N_("E1127: Missing name after dot"));
|
||||
#endif
|
||||
|
@ -1538,6 +1538,16 @@ def Test_expr7_list()
|
||||
CheckDefExecFailure(["var l: list<number> = ['x', 234]"], 'E1012:', 1)
|
||||
CheckDefExecFailure(["var l: list<string> = [234, 'x']"], 'E1012:', 1)
|
||||
CheckDefExecFailure(["var l: list<string> = ['x', 123]"], 'E1012:', 1)
|
||||
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
var datalist: list<string>
|
||||
def Main()
|
||||
datalist += ['x'.
|
||||
enddef
|
||||
Main()
|
||||
END
|
||||
CheckScriptFailure(lines, 'E1127:')
|
||||
enddef
|
||||
|
||||
def Test_expr7_list_vim9script()
|
||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1789,
|
||||
/**/
|
||||
1788,
|
||||
/**/
|
||||
|
@ -2549,7 +2549,7 @@ compile_list(char_u **arg, cctx_T *cctx)
|
||||
break;
|
||||
}
|
||||
if (compile_expr0(&p, cctx) == FAIL)
|
||||
break;
|
||||
return FAIL;
|
||||
++count;
|
||||
if (*p == ',')
|
||||
{
|
||||
@ -3333,7 +3333,10 @@ compile_subscript(
|
||||
|
||||
*arg = p + 1;
|
||||
if (may_get_next_line(*arg, arg, cctx) == FAIL)
|
||||
{
|
||||
emsg(_(e_missing_name_after_dot));
|
||||
return FAIL;
|
||||
}
|
||||
// dictionary member: dict.name
|
||||
p = *arg;
|
||||
if (eval_isdictc(*p))
|
||||
|
Loading…
x
Reference in New Issue
Block a user