Skip to content

Commit 1b91298

Browse files
committed
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)
1 parent f43e7ac commit 1b91298

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

src/map.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2304,6 +2304,8 @@ f_mapset(typval_T *argvars, typval_T *rettv UNUSED)
23042304
char_u *arg;
23052305

23062306
which = tv_get_string_buf_chk(&argvars[0], buf);
2307+
if (which == NULL)
2308+
return;
23072309
mode = get_map_mode(&which, 0);
23082310
is_abbr = (int)tv_get_number(&argvars[1]);
23092311

src/testdir/test_maparg.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ func Test_mapset()
238238
iunmap K
239239
let &cpo = cpo_save
240240
bwipe!
241+
242+
call assert_fails('call mapset([], v:false, {})', 'E730:')
241243
endfunc
242244

243245
func Check_ctrlb_map(d, check_alt)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
1773,
753755
/**/
754756
1772,
755757
/**/

0 commit comments

Comments
 (0)