1
0
forked from aniani/vim

patch 8.2.1802: Vim9: crash with unterminated dict

Problem:    Vim9: crash with unterminated dict. (Dhiraj Mishra)
Solution:   Return empty string instead of NULL. (closes #7084)
This commit is contained in:
Bram Moolenaar
2020-10-05 19:23:59 +02:00
parent 55b419b871
commit 44aefffaad
3 changed files with 7 additions and 0 deletions

View File

@@ -1819,6 +1819,8 @@ def Test_expr7_dict()
CheckDefExecFailure(['var x: dict<number> = #{a: "x", b: 134}'], 'E1012:', 1)
CheckDefExecFailure(['var x: dict<string> = #{a: 234, b: "1"}'], 'E1012:', 1)
CheckDefExecFailure(['var x: dict<string> = #{a: "x", b: 134}'], 'E1012:', 1)
CheckDefFailure(['var x = ({'], 'E723:', 2)
enddef
def Test_expr7_dict_vim9script()

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1802,
/**/
1801,
/**/

View File

@@ -2822,7 +2822,10 @@ compile_dict(char_u **arg, cctx_T *cctx, int literal)
failret:
if (*arg == NULL)
{
semsg(_(e_missing_dict_end), _("[end of lines]"));
*arg = (char_u *)"";
}
dict_unref(d);
return FAIL;
}