]> granicus.if.org Git - vim/commitdiff
patch 8.2.1773: crash when calling mapset() with a list as first argument v8.2.1773
authorBram Moolenaar <Bram@vim.org>
Tue, 29 Sep 2020 19:45:41 +0000 (21:45 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 29 Sep 2020 19:45:41 +0000 (21:45 +0200)
Problem:    Crash when calling mapset() with a list as first argument.
Solution:   Check for NULL. (closes #7040)

src/map.c
src/testdir/test_maparg.vim
src/version.c

index eed3a55d041ee7a94a044400f69bca86a5d8dbd6..6a994d41850ba5784cf247772eda58866857c6ec 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -2304,6 +2304,8 @@ f_mapset(typval_T *argvars, typval_T *rettv UNUSED)
     char_u     *arg;
 
     which = tv_get_string_buf_chk(&argvars[0], buf);
+    if (which == NULL)
+       return;
     mode = get_map_mode(&which, 0);
     is_abbr = (int)tv_get_number(&argvars[1]);
 
index ea921d6386a1ef90bfa4d2eaef457cb8696a9ce2..285474d527059bc81f0705e9d6c3713e7bd25782 100644 (file)
@@ -238,6 +238,8 @@ func Test_mapset()
   iunmap K
   let &cpo = cpo_save
   bwipe!
+
+  call assert_fails('call mapset([], v:false, {})', 'E730:')
 endfunc
 
 func Check_ctrlb_map(d, check_alt)
index d5c8f3027786294f3be589970e7fbe5c70df0a9b..acac541febba3bdf31737ed1563393b7c38978cf 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1773,
 /**/
     1772,
 /**/