Mercurial > vim
changeset 29744:1e9ee1b61d6d v9.0.0212
patch 9.0.0212: invalid memory access when compiling :unlet
Commit: https://github.com/vim/vim/commit/dbdd16b62560413abcc3c8e893cc3010ccf31666
Author: Bram Moolenaar <Bram@vim.org>
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 14 Aug 2022 23:00:04 +0200 |
parents | 806c3ef643fe |
children | 51b8882fa024 |
files | src/testdir/test_vim9_cmd.vim src/version.c src/vim9cmds.c |
diffstat | 3 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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()
--- 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,
--- 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.