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 -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220814202902.9E9E31C04B1%40moolenaar.net.