Skip to content

Commit

Permalink
patch 9.0.0212: invalid memory access when compiling :unlet
Browse files Browse the repository at this point in the history
Problem:    Invalid memory access when compiling :unlet.
Solution:   Don't read past the end of the line.
  • Loading branch information
brammool committed Aug 14, 2022
1 parent d1d8f6b commit dbdd16b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/testdir/test_vim9_cmd.vim
Expand Up @@ -1740,12 +1740,19 @@ def Test_lockvar()

lines =<< trim END
def _()
s:0([], s:0)
lockv
enddef
defcomp
END
v9.CheckScriptFailure(lines, 'E179', 2)
v9.CheckScriptFailure(lines, 'E179', 1)

lines =<< trim END
def T()
unlet
enddef
defcomp
END
v9.CheckScriptFailure(lines, 'E179', 1)
enddef

def Test_substitute_expr()
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -735,6 +735,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
212,
/**/
211,
/**/
Expand Down
6 changes: 6 additions & 0 deletions src/vim9cmds.c
Expand Up @@ -92,6 +92,12 @@ free_locals(cctx_T *cctx)
int
check_vim9_unlet(char_u *name)
{
if (*name == NUL)
{
semsg(_(e_argument_required_for_str), "unlet");
return FAIL;
}

if (name[1] != ':' || vim_strchr((char_u *)"gwtb", *name) == NULL)
{
// "unlet s:var" is allowed in legacy script.
Expand Down

0 comments on commit dbdd16b

Please sign in to comment.