0
0
mirror of https://github.com/vim/vim.git synced 2025-09-06 21:53:38 -04:00

patch 8.2.4108: going over the end of the w_lines array

Problem:    Going over the end of the w_lines array.
Solution:   Check not going over the end and limit to Rows. (issue #9540)
This commit is contained in:
Bram Moolenaar 2022-01-16 13:58:33 +00:00
parent a9725221ac
commit f6ebc82004
2 changed files with 7 additions and 2 deletions

View File

@ -1815,10 +1815,11 @@ win_update(win_T *wp)
// When topline didn't change, find first entry in w_lines[] that // When topline didn't change, find first entry in w_lines[] that
// needs updating. // needs updating.
// try to find wp->w_topline in wp->w_lines[].wl_lnum // Try to find wp->w_topline in wp->w_lines[].wl_lnum. The check
// for "Rows" is in case "wl_size" is incorrect somehow.
j = -1; j = -1;
row = 0; row = 0;
for (i = 0; i < wp->w_lines_valid; i++) for (i = 0; i < wp->w_lines_valid && i < Rows; i++)
{ {
if (wp->w_lines[i].wl_valid if (wp->w_lines[i].wl_valid
&& wp->w_lines[i].wl_lnum == wp->w_topline) && wp->w_lines[i].wl_lnum == wp->w_topline)
@ -1848,6 +1849,8 @@ win_update(win_T *wp)
// ... but don't delete new filler lines. // ... but don't delete new filler lines.
row -= wp->w_topfill; row -= wp->w_topfill;
#endif #endif
if (row > Rows) // just in case
row = Rows;
if (row > 0) if (row > 0)
{ {
check_for_delay(FALSE); check_for_delay(FALSE);

View File

@ -750,6 +750,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 */
/**/
4108,
/**/ /**/
4107, 4107,
/**/ /**/