mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 9.0.0211: invalid memory access when compiling :lockvar
Problem: Invalid memory access when compiling :lockvar. Solution: Don't read past the end of the line.
This commit is contained in:
@@ -1737,6 +1737,15 @@ def Test_lockvar()
|
|||||||
UnLockIt()
|
UnLockIt()
|
||||||
END
|
END
|
||||||
v9.CheckScriptFailure(lines, 'E46', 1)
|
v9.CheckScriptFailure(lines, 'E46', 1)
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
def _()
|
||||||
|
s:0([], s:0)
|
||||||
|
lockv
|
||||||
|
enddef
|
||||||
|
defcomp
|
||||||
|
END
|
||||||
|
v9.CheckScriptFailure(lines, 'E179', 2)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_substitute_expr()
|
def Test_substitute_expr()
|
||||||
|
@@ -735,6 +735,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
211,
|
||||||
/**/
|
/**/
|
||||||
210,
|
210,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -188,10 +188,17 @@ compile_lock_unlock(
|
|||||||
size_t len;
|
size_t len;
|
||||||
char_u *buf;
|
char_u *buf;
|
||||||
isntype_T isn = ISN_EXEC;
|
isntype_T isn = ISN_EXEC;
|
||||||
|
char *cmd = eap->cmdidx == CMD_lockvar ? "lockvar" : "unlockvar";
|
||||||
|
|
||||||
if (cctx->ctx_skip == SKIP_YES)
|
if (cctx->ctx_skip == SKIP_YES)
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
|
if (*p == NUL)
|
||||||
|
{
|
||||||
|
semsg(_(e_argument_required_for_str), cmd);
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
// Cannot use :lockvar and :unlockvar on local variables.
|
// Cannot use :lockvar and :unlockvar on local variables.
|
||||||
if (p[1] != ':')
|
if (p[1] != ':')
|
||||||
{
|
{
|
||||||
@@ -223,8 +230,6 @@ compile_lock_unlock(
|
|||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *cmd = eap->cmdidx == CMD_lockvar ? "lockvar" : "unlockvar";
|
|
||||||
|
|
||||||
if (deep < 0)
|
if (deep < 0)
|
||||||
vim_snprintf((char *)buf, len, "%s! %s", cmd, p);
|
vim_snprintf((char *)buf, len, "%s! %s", cmd, p);
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user