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

Commit: 
https://github.com/vim/vim/commit/bca154920757b23972bf9024c54c5fd0a8870bcd
Author: Foxe Chen <[email protected]>
Date:   Mon Jun 8 19:04:11 2026 +0000

    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 <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/screen.c b/src/screen.c
index 9042d90de..97d2f189c 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -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);
diff --git a/src/version.c b/src/version.c
index c9032621c..aae300c55 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    603,
 /**/
     602,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1wWffg-004zVN-6k%40256bit.org.

Raspunde prin e-mail lui