patch 9.2.0603: possible heap-buffer-overflow when resizing the GUI

Problem:  possible heap-buffer-overflow when resizing the GUI
Solution: Check that the cursor position falls inside the GUI display
          area (Foxe Chen).

closes: #20449

Supported by AI

Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Foxe Chen
2026-06-08 19:04:11 +00:00
committed by Christian Brabandt
parent 1ffc1aaa43
commit bca1549207
2 changed files with 9 additions and 0 deletions
+7
View File
@@ -3378,6 +3378,13 @@ give_up:
screen_Rows = Rows;
screen_Columns = Columns;
#ifdef FEAT_GUI
// Cursor position may now be out of bounds after resize
if (gui.in_use && (gui.cursor_row >= screen_Rows
|| gui.cursor_col >= screen_Columns))
gui.cursor_is_valid = false;
#endif
set_must_redraw(UPD_CLEAR); // need to clear the screen later
if (doclear)
screenclear2(TRUE);
+2
View File
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
603,
/**/
602,
/**/