# HG changeset patch # User Bram Moolenaar # Date 1660510804 -7200 # Node ID 1e9ee1b61d6dc8c3bdf46ea079fd4de7c94e081c # Parent 806c3ef643fe377ba74c61a24504bc3ee914c3a9 patch 9.0.0212: invalid memory access when compiling :unlet Commit: https://github.com/vim/vim/commit/dbdd16b62560413abcc3c8e893cc3010ccf31666 Author: Bram Moolenaar Date: Sun Aug 14 21:46:07 2022 +0100 patch 9.0.0212: invalid memory access when compiling :unlet Problem: Invalid memory access when compiling :unlet. Solution: Don't read past the end of the line. diff --git a/src/testdir/test_vim9_cmd.vim b/src/testdir/test_vim9_cmd.vim --- a/src/testdir/test_vim9_cmd.vim +++ b/src/testdir/test_vim9_cmd.vim @@ -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() diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -736,6 +736,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 212, +/**/ 211, /**/ 210, diff --git a/src/vim9cmds.c b/src/vim9cmds.c --- a/src/vim9cmds.c +++ b/src/vim9cmds.c @@ -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.