diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-01-16 13:58:33 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-16 13:58:33 +0000 |
commit | f6ebc820041b3f77794297026b46c1ebbc279a3a (patch) | |
tree | 9ce26dae26bafa945949bff192c3bb2e86564fa4 | |
parent | a9725221ac4650b7e9219bf6e3682826fe2e0096 (diff) | |
download | vim-git-f6ebc820041b3f77794297026b46c1ebbc279a3a.tar.gz |
patch 8.2.4108: going over the end of the w_lines arrayv8.2.4108
Problem: Going over the end of the w_lines array.
Solution: Check not going over the end and limit to Rows. (issue #9540)
-rw-r--r-- | src/drawscreen.c | 7 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/drawscreen.c b/src/drawscreen.c index e0fb12299..d03c429cc 100644 --- a/src/drawscreen.c +++ b/src/drawscreen.c @@ -1815,10 +1815,11 @@ win_update(win_T *wp) // When topline didn't change, find first entry in w_lines[] that // 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; 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 && 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. row -= wp->w_topfill; #endif + if (row > Rows) // just in case + row = Rows; if (row > 0) { check_for_delay(FALSE); diff --git a/src/version.c b/src/version.c index ec96b869a..c8983be66 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4108, +/**/ 4107, /**/ 4106, |