mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 7.4.1052
Problem: Illegal memory access with weird syntax command. (Dominique Pelle) Solution: Check for column past end of line.
This commit is contained in:
@@ -3022,6 +3022,8 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos,
|
|||||||
if (r && regmatch.startpos[0].col
|
if (r && regmatch.startpos[0].col
|
||||||
<= best_regmatch.startpos[0].col)
|
<= best_regmatch.startpos[0].col)
|
||||||
{
|
{
|
||||||
|
int line_len;
|
||||||
|
|
||||||
/* Add offset to skip pattern match */
|
/* Add offset to skip pattern match */
|
||||||
syn_add_end_off(&pos, ®match, spp_skip, SPO_ME_OFF, 1);
|
syn_add_end_off(&pos, ®match, spp_skip, SPO_ME_OFF, 1);
|
||||||
|
|
||||||
@@ -3031,6 +3033,7 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
line = ml_get_buf(syn_buf, startpos->lnum, FALSE);
|
line = ml_get_buf(syn_buf, startpos->lnum, FALSE);
|
||||||
|
line_len = (int)STRLEN(line);
|
||||||
|
|
||||||
/* take care of an empty match or negative offset */
|
/* take care of an empty match or negative offset */
|
||||||
if (pos.col <= matchcol)
|
if (pos.col <= matchcol)
|
||||||
@@ -3040,12 +3043,12 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos,
|
|||||||
else
|
else
|
||||||
/* Be careful not to jump over the NUL at the end-of-line */
|
/* Be careful not to jump over the NUL at the end-of-line */
|
||||||
for (matchcol = regmatch.endpos[0].col;
|
for (matchcol = regmatch.endpos[0].col;
|
||||||
line[matchcol] != NUL && matchcol < pos.col;
|
matchcol < line_len && matchcol < pos.col;
|
||||||
++matchcol)
|
++matchcol)
|
||||||
;
|
;
|
||||||
|
|
||||||
/* if the skip pattern includes end-of-line, break here */
|
/* if the skip pattern includes end-of-line, break here */
|
||||||
if (line[matchcol] == NUL)
|
if (matchcol >= line_len)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
continue; /* start with first end pattern again */
|
continue; /* start with first end pattern again */
|
||||||
|
@@ -741,6 +741,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 */
|
||||||
|
/**/
|
||||||
|
1052,
|
||||||
/**/
|
/**/
|
||||||
1051,
|
1051,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user