From fe0bee6f9fe1325a3ccfef93c5f7829d5ba9f612 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 10 Nov 2022 11:39:14 -0800 Subject: [PATCH] Gtk3: fix stack smashing on mismatch between bool and gboolean Glib is written in C and predates C99 (though not really, glib 2.0 was released in 2002), so it defines gboolean as int, a 4-byte type. C++'s bool is a 1-byte type, so this caused a buffer overflow. Problem introduced in 2b77e779ce43386d14bdd2d1109ee182bcd0d047 ("QGtk3Theme: implement appearance function to detect dark themes"). Change-Id: Ieba79baf5ac34264a988fffd172650701fa54da8 Reviewed-by: Shawn Rutledge (cherry picked from commit 28d9f05fa1593b252e98965c8a4c6c4c7c2cf4a7) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platformthemes/gtk3/qgtk3theme.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp index b00d618f7e2..09087cf4ef3 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp @@ -190,7 +190,7 @@ QPlatformTheme::Appearance QGtk3Theme::appearance() const gtk-theme-name provides both light and dark variants. We can save a regex check by testing this property first. */ - const auto preferDark = gtkSetting("gtk-application-prefer-dark-theme"); + const auto preferDark = gtkSetting("gtk-application-prefer-dark-theme"); if (preferDark) return Appearance::Dark;