0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.1.1497: accessing memory beyond allocated space

Problem:    Accessing memory beyond allocated space.
Solution:   Check column before accessing popup mask.
This commit is contained in:
Bram Moolenaar
2019-06-08 17:25:33 +02:00
parent acc682bd7c
commit aef5c62a6f
2 changed files with 25 additions and 18 deletions

View File

@@ -6797,35 +6797,40 @@ screen_line(
if (clear_width > 0 if (clear_width > 0
#ifdef FEAT_TEXT_PROP #ifdef FEAT_TEXT_PROP
&& !(flags & SLF_POPUP) // no separator for popup window && !(flags & SLF_POPUP) // no separator for popup window
&& popup_mask[row * screen_Columns + col + coloff] <= screen_zindex
#endif #endif
) )
{ {
// For a window that has a right neighbor, draw the separator char // For a window that has a right neighbor, draw the separator char
// right of the window contents. // right of the window contents. But not on top of a popup window.
if (coloff + col < Columns) if (coloff + col < Columns)
{ {
int c; #ifdef FEAT_TEXT_PROP
if (popup_mask[row * screen_Columns + col + coloff]
c = fillchar_vsep(&hl); <= screen_zindex)
if (ScreenLines[off_to] != (schar_T)c #endif
|| (enc_utf8 && (int)ScreenLinesUC[off_to]
!= (c >= 0x80 ? c : 0))
|| ScreenAttrs[off_to] != hl)
{ {
ScreenLines[off_to] = c; int c;
ScreenAttrs[off_to] = hl;
if (enc_utf8) c = fillchar_vsep(&hl);
if (ScreenLines[off_to] != (schar_T)c
|| (enc_utf8 && (int)ScreenLinesUC[off_to]
!= (c >= 0x80 ? c : 0))
|| ScreenAttrs[off_to] != hl)
{ {
if (c >= 0x80) ScreenLines[off_to] = c;
ScreenAttrs[off_to] = hl;
if (enc_utf8)
{ {
ScreenLinesUC[off_to] = c; if (c >= 0x80)
ScreenLinesC[0][off_to] = 0; {
ScreenLinesUC[off_to] = c;
ScreenLinesC[0][off_to] = 0;
}
else
ScreenLinesUC[off_to] = 0;
} }
else screen_char(off_to, row, col + coloff);
ScreenLinesUC[off_to] = 0;
} }
screen_char(off_to, row, col + coloff);
} }
} }
else else

View File

@@ -767,6 +767,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 */
/**/
1497,
/**/ /**/
1496, 1496,
/**/ /**/