]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0654: GTK4: using uninitialised colors in gui_mch_init() v9.2.0654
authorYasuhiro Matsumoto <mattn.jp@gmail.com>
Tue, 16 Jun 2026 19:00:26 +0000 (19:00 +0000)
committerChristian Brabandt <cb@256bit.org>
Tue, 16 Jun 2026 19:00:26 +0000 (19:00 +0000)
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 <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/gui_gtk4.c
src/version.c

index b3135a0ab8e889acaddb20104e00b1fbac5698f3..82c9248a782fe8b1cfec09de2f1c934761262af7 100644 (file)
@@ -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
index de75d3eefa6b86b92256070b26e61d4020f11cef..7e6c274f18b746eb83aa0795540dc7058f4e9f31 100644 (file)
@@ -759,6 +759,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    654,
 /**/
     653,
 /**/