changeset 22450:9b09676b9e0e v8.2.1773

patch 8.2.1773: crash when calling mapset() with a list as first argument Commit: https://github.com/vim/vim/commit/1b9129809d8269acb8e7c79d8fc99c7976b4f76e Author: Bram Moolenaar <Bram@vim.org> Date: Tue Sep 29 21:45:41 2020 +0200 patch 8.2.1773: crash when calling mapset() with a list as first argument Problem: Crash when calling mapset() with a list as first argument. Solution: Check for NULL. (closes https://github.com/vim/vim/issues/7040)
author Bram Moolenaar <Bram@vim.org>
date Tue, 29 Sep 2020 22:00:06 +0200
parents 256800bad022
children 9e097eb15d54
files src/map.c src/testdir/test_maparg.vim src/version.c
diffstat 3 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/map.c
+++ b/src/map.c
@@ -2304,6 +2304,8 @@ f_mapset(typval_T *argvars, typval_T *re
     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]);
 
--- a/src/testdir/test_maparg.vim
+++ b/src/testdir/test_maparg.vim
@@ -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)
--- 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 */
 /**/
+    1773,
+/**/
     1772,
 /**/
     1771,