Patch 9.0.0211

3 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 14, 2022, 4:29:15 PM8/14/22
to vim...@googlegroups.com

Patch 9.0.0211
Problem: Invalid memory access when compiling :lockvar.
Solution: Don't read past the end of the line.
Files: src/vim9cmds.c, src/testdir/test_vim9_cmd.vim


*** ../vim-9.0.0210/src/vim9cmds.c 2022-04-25 12:30:38.000000000 +0100
--- src/vim9cmds.c 2022-08-14 21:26:42.774209100 +0100
***************
*** 188,197 ****
--- 188,204 ----
size_t len;
char_u *buf;
isntype_T isn = ISN_EXEC;
+ char *cmd = eap->cmdidx == CMD_lockvar ? "lockvar" : "unlockvar";

if (cctx->ctx_skip == SKIP_YES)
return OK;

+ if (*p == NUL)
+ {
+ semsg(_(e_argument_required_for_str), cmd);
+ return FAIL;
+ }
+
// Cannot use :lockvar and :unlockvar on local variables.
if (p[1] != ':')
{
***************
*** 223,230 ****
ret = FAIL;
else
{
- char *cmd = eap->cmdidx == CMD_lockvar ? "lockvar" : "unlockvar";
-
if (deep < 0)
vim_snprintf((char *)buf, len, "%s! %s", cmd, p);
else
--- 230,235 ----
*** ../vim-9.0.0210/src/testdir/test_vim9_cmd.vim 2022-08-04 18:50:10.882699744 +0100
--- src/testdir/test_vim9_cmd.vim 2022-08-14 21:25:01.558216105 +0100
***************
*** 1737,1742 ****
--- 1737,1751 ----
UnLockIt()
END
v9.CheckScriptFailure(lines, 'E46', 1)
+
+ lines =<< trim END
+ def _()
+ s:0([], s:0)
+ lockv
+ enddef
+ defcomp
+ END
+ v9.CheckScriptFailure(lines, 'E179', 2)
enddef

def Test_substitute_expr()
*** ../vim-9.0.0210/src/version.c 2022-08-14 19:36:51.503751154 +0100
--- src/version.c 2022-08-14 21:19:11.562236432 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 211,
/**/

--
Proverb: A nightingale that forgets the lyrics is a hummingbird.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages