From: Bram Moolenaar Date: Tue, 29 Sep 2020 19:45:41 +0000 (+0200) Subject: patch 8.2.1773: crash when calling mapset() with a list as first argument X-Git-Tag: v8.2.1773 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1b9129809d8269acb8e7c79d8fc99c7976b4f76e;p=vim 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 #7040) --- diff --git a/src/map.c b/src/map.c index eed3a55d0..6a994d418 100644 --- 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]); diff --git a/src/testdir/test_maparg.vim b/src/testdir/test_maparg.vim index ea921d638..285474d52 100644 --- 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) diff --git a/src/version.c b/src/version.c index d5c8f3027..acac541fe 100644 --- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1773, /**/ 1772, /**/