patch 9.2.0654: GTK4: using uninitialised colors in gui_mch_init()

Commit: 
https://github.com/vim/vim/commit/01ebc571befb3495a7f951e5175c1ac8faa39afb
Author: Yasuhiro Matsumoto <[email protected]>
Date:   Tue Jun 16 19:00:26 2026 +0000

    patch 9.2.0654: GTK4: using uninitialised colors in gui_mch_init()
    
    Problem:  GTK4: using uninitialised colors in gui_mch_init()
    Solution: Use g_new0() instead of g_new() (Yasuhiro Matsumoto)
    
    gui.fgcolor/bgcolor/spcolor were allocated with g_new(), leaving the
    GdkRGBA fields uninitialised. On widget realize/map GTK runs
    gui_mch_new_colors() -> surface_fill_bg() before gui_mch_set_bg_color()
    assigns them, so cairo_set_source_rgba() branched on uninitialised
    values (reported by valgrind). Use g_new0() to zero-initialise.
    
    closes: #20538
    
    Signed-off-by: Yasuhiro Matsumoto <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/gui_gtk4.c b/src/gui_gtk4.c
index b3135a0ab..82c9248a7 100644
--- a/src/gui_gtk4.c
+++ b/src/gui_gtk4.c
@@ -444,9 +444,9 @@ gui_mch_init_check(void)
 gui_mch_init(void)
 {
     // Allocate GdkRGBA color structs.
-    gui.fgcolor = g_new(GdkRGBA, 1);
-    gui.bgcolor = g_new(GdkRGBA, 1);
-    gui.spcolor = g_new(GdkRGBA, 1);
+    gui.fgcolor = g_new0(GdkRGBA, 1);
+    gui.bgcolor = g_new0(GdkRGBA, 1);
+    gui.spcolor = g_new0(GdkRGBA, 1);
 
     gui.def_norm_pixel = 0x00000000;   // black
     gui.def_back_pixel = 0x00ffffff;   // white
diff --git a/src/version.c b/src/version.c
index de75d3eef..7e6c274f1 100644
--- a/src/version.c
+++ b/src/version.c
@@ -759,6 +759,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    654,
 /**/
     653,
 /**/

-- 
-- 
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/E1wZZFa-000xrO-2S%40256bit.org.

Raspunde prin e-mail lui