diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-09-26 23:08:22 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-09-26 23:08:22 +0100 |
commit | 8279af514ca7e5fd3c31cf13b0864163d1a0bfeb (patch) | |
tree | de69a0a7677c75f63bea91ec39204549c750b518 /src/window.c | |
parent | 3bdef10dc1c836e5e5a6fdcc1c21155cbd80d798 (diff) | |
download | vim-git-8279af514ca7e5fd3c31cf13b0864163d1a0bfeb.tar.gz |
patch 9.0.0598: using negative array index with negative width windowv9.0.0598
Problem: Using negative array index with negative width window.
Solution: Make sure the window width does not become negative.
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/window.c b/src/window.c index 755848e43..db08e4132 100644 --- a/src/window.c +++ b/src/window.c @@ -2089,6 +2089,8 @@ win_equal_rec( if (hnc) // add next_curwin size { next_curwin_size -= p_wiw - (m - n); + if (next_curwin_size < 0) + next_curwin_size = 0; new_size += next_curwin_size; room -= new_size - next_curwin_size; } @@ -6611,7 +6613,8 @@ scroll_to_fraction(win_T *wp, int prev_height) void win_new_width(win_T *wp, int width) { - wp->w_width = width; + // Should we give an error if width < 0? + wp->w_width = width < 0 ? 0 : width; wp->w_lines_valid = 0; changed_line_abv_curs_win(wp); // Handled in win_fix_scroll() |