changeset 22508:ac8c4a8b8cba v8.2.1802

patch 8.2.1802: Vim9: crash with unterminated dict Commit: https://github.com/vim/vim/commit/44aefffaad067886d266999cd17cf852b2a7e0b9 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Oct 5 19:23:59 2020 +0200 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 https://github.com/vim/vim/issues/7084)
author Bram Moolenaar <Bram@vim.org>
date Mon, 05 Oct 2020 19:30:04 +0200
parents d224034e6124
children d5615d1eed10
files src/testdir/test_vim9_expr.vim src/version.c src/vim9compile.c
diffstat 3 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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()
--- 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,
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2822,7 +2822,10 @@ compile_dict(char_u **arg, cctx_T *cctx,
 
 failret:
     if (*arg == NULL)
+    {
 	semsg(_(e_missing_dict_end), _("[end of lines]"));
+	*arg = (char_u *)"";
+    }
     dict_unref(d);
     return FAIL;
 }