summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-10-05 19:23:59 +0200
committerBram Moolenaar <Bram@vim.org>2020-10-05 19:23:59 +0200
commit44aefffaad067886d266999cd17cf852b2a7e0b9 (patch)
tree8cf71d06229cd040be64aa8af9583ffb9defe3ea /src
parent55b419b871dd35f5b05dd2aed65f14461b493ba9 (diff)
patch 8.2.1802: Vim9: crash with unterminated dictv8.2.1802
Problem: Vim9: crash with unterminated dict. (Dhiraj Mishra) Solution: Return empty string instead of NULL. (closes #7084)
Diffstat (limited to 'src')
-rw-r--r--src/testdir/test_vim9_expr.vim2
-rw-r--r--src/version.c2
-rw-r--r--src/vim9compile.c3
3 files changed, 7 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim
index 2cbb2854a6..9292a77d6d 100644
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -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()
diff --git a/src/version.c b/src/version.c
index 80b93196fe..244c26d09f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1802,
+/**/
1801,
/**/
1800,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 373d76c6e2..a6bdcc3f3d 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -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;
}