Submitted By: Ken Moffat Date: 2024-07-12 Initial Package Version: 2.24.33 Upstream Status: Defunct Origin: Fedora, and backport by me. Description: 1. A series of build fixes for gcc-14 which finally removed some deprecated items. 2. The CVE-2024-6655 fix from gtk+3-3.24.43 The fedota -c99 and -c89{,-2..6} patches commit bcfc53066ae54d0adbf282d5678d9a4a7083b4d3 Author: Javier Jardón Date: Mon May 3 02:56:29 2010 +0200 tests: Too many arguments in call to 'create_menu' diff --git a/tests/testmenubars.c b/tests/testmenubars.c index 416a93986121d858..853d822a9b6a7925 100644 --- a/tests/testmenubars.c +++ b/tests/testmenubars.c @@ -21,7 +21,7 @@ #include static GtkWidget * -create_menu (depth) +create_menu (guint depth) { GtkWidget *menu; GtkWidget *menuitem; @@ -70,19 +70,19 @@ create_menubar (GtkPackDirection pack_dir, menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_HOME, NULL); gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem); gtk_label_set_angle (GTK_LABEL (GTK_BIN (menuitem)->child), angle); - menu = create_menu (2, TRUE); + menu = create_menu (2); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu); menuitem = gtk_menu_item_new_with_label ("foo"); gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem); gtk_label_set_angle (GTK_LABEL (GTK_BIN (menuitem)->child), angle); - menu = create_menu (2, TRUE); + menu = create_menu (2); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu); menuitem = gtk_menu_item_new_with_label ("bar"); gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem); gtk_label_set_angle (GTK_LABEL (GTK_BIN (menuitem)->child), angle); - menu = create_menu (2, TRUE); + menu = create_menu (2); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu); return menubar; commit 072f06abf713d7536ce2a84a5ac266f585c88d39 Author: Matthias Clasen Date: Fri Dec 8 17:48:47 2017 -0500 Fix fallout from g_object_ref change g_object_ref now returns the type of the object that was passed. Introduce cast as necessary to avoid warnings due to this. diff --git a/gtk/gtkcellrendererspin.c b/gtk/gtkcellrendererspin.c index 2a3961bf203cbe59..7129d05e3b2c1ae6 100644 --- a/gtk/gtkcellrendererspin.c +++ b/gtk/gtkcellrendererspin.c @@ -207,7 +207,8 @@ gtk_cell_renderer_spin_set_property (GObject *object, } if (obj) - priv->adjustment = g_object_ref_sink (obj); + priv->adjustment = GTK_ADJUSTMENT (g_object_ref_sink (obj)); + break; case PROP_CLIMB_RATE: priv->climb_rate = g_value_get_double (value); diff --git a/gtk/gtkcomboboxtext.c b/gtk/gtkcomboboxtext.c index 9ffba687660c1214..5e75323c2c55d491 100644 --- a/gtk/gtkcomboboxtext.c +++ b/gtk/gtkcomboboxtext.c @@ -275,7 +275,7 @@ gtk_combo_box_text_buildable_custom_tag_start (GtkBuildable *buildable, parser_data = g_slice_new0 (ItemParserData); parser_data->builder = g_object_ref (builder); - parser_data->object = g_object_ref (buildable); + parser_data->object = (GObject *)g_object_ref (buildable); parser_data->domain = gtk_builder_get_translation_domain (builder); *parser = item_parser; *data = parser_data; diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index c47de5924f6f0b49..879586b0d9855374 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -1336,7 +1336,7 @@ gtk_label_buildable_custom_tag_start (GtkBuildable *buildable, parser_data = g_slice_new0 (PangoParserData); parser_data->builder = g_object_ref (builder); - parser_data->object = g_object_ref (buildable); + parser_data->object = (GObject *) g_object_ref (buildable); *parser = pango_parser; *data = parser_data; return TRUE; diff --git a/gtk/gtktoolpalette.c b/gtk/gtktoolpalette.c index b984193ca3375223..ba4e472dea4ebd77 100644 --- a/gtk/gtktoolpalette.c +++ b/gtk/gtktoolpalette.c @@ -734,7 +734,7 @@ gtk_tool_palette_add (GtkContainer *container, g_ptr_array_add (palette->priv->groups, info); info->pos = palette->priv->groups->len - 1; - info->widget = g_object_ref_sink (child); + info->widget = (GtkToolItemGroup *)g_object_ref_sink (child); gtk_widget_set_parent (child, GTK_WIDGET (palette)); } diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 89301eb91d21c793..0d2d15b4883a7110 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -14147,7 +14147,7 @@ gtk_tree_view_set_search_entry (GtkTreeView *tree_view, if (entry) { - tree_view->priv->search_entry = g_object_ref (entry); + tree_view->priv->search_entry = GTK_WIDGET (g_object_ref (entry)); tree_view->priv->search_custom_entry_set = TRUE; if (tree_view->priv->search_entry_changed_id == 0) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index d8f6023ba3ae164c..b6d7b815505760da 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -10686,7 +10686,7 @@ gtk_widget_buildable_custom_tag_start (GtkBuildable *buildable, AccelGroupParserData *parser_data; parser_data = g_slice_new0 (AccelGroupParserData); - parser_data->object = g_object_ref (buildable); + parser_data->object = (GObject *)g_object_ref (buildable); *parser = accel_group_parser; *data = parser_data; return TRUE; diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c index 2a000dc16ff57582..e081a70c45743fd2 100644 --- a/modules/printbackends/cups/gtkprintbackendcups.c +++ b/modules/printbackends/cups/gtkprintbackendcups.c @@ -3479,7 +3479,7 @@ cups_request_ppd (GtkPrinter *printer) g_io_channel_set_encoding (data->ppd_io, NULL, NULL); g_io_channel_set_close_on_unref (data->ppd_io, TRUE); - data->printer = g_object_ref (printer); + data->printer = (GtkPrinterCups *) g_object_ref (printer); resource = g_strdup_printf ("/printers/%s.ppd", gtk_printer_cups_get_ppd_name (GTK_PRINTER_CUPS (printer))); diff --git a/tests/testentrycompletion.c b/tests/testentrycompletion.c index 36c41f78a42fb928..c556734b72ef71b0 100644 --- a/tests/testentrycompletion.c +++ b/tests/testentrycompletion.c @@ -237,7 +237,7 @@ animation_timer (GtkEntryCompletion *completion) { g_print ("removing model!\n"); - old_store = g_object_ref (gtk_entry_completion_get_model (completion)); + old_store = GTK_LIST_STORE (g_object_ref (gtk_entry_completion_get_model (completion))); gtk_entry_completion_set_model (completion, NULL); } else commit 018a4255624928fb7d951f1d1c89196fe77e8267 Author: Cosimo Cecchi Date: Mon Feb 18 19:37:20 2013 -0500 immodule: fix a GCC warning diff --git a/gtk/gtkimmodule.c b/gtk/gtkimmodule.c index 1fcb17a7d87f197c..445b2be87f57742f 100644 --- a/gtk/gtkimmodule.c +++ b/gtk/gtkimmodule.c @@ -662,7 +662,7 @@ lookup_immodule (gchar **immodules_list) gboolean found; gchar *context_id; found = g_hash_table_lookup_extended (contexts_hash, *immodules_list, - &context_id, NULL); + (gpointer *) &context_id, NULL); if (found) return context_id; } Partial backport of: commit 345d865ac6b2f7760503ab144dd68e6062438b80 Author: Matthias Clasen Date: Wed Jan 18 00:57:20 2012 -0500 GtkScale: Fix late setting of marks diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c index 4317523fb8f1918a..a573b2f6ba203b92 100644 --- a/gtk/gtkscale.c +++ b/gtk/gtkscale.c @@ -1471,7 +1471,7 @@ gtk_scale_add_mark (GtkScale *scale, mark->position = position; priv->marks = g_slist_insert_sorted_with_data (priv->marks, mark, - (GCompareFunc) compare_marks, + compare_marks, GINT_TO_POINTER ( gtk_range_get_inverted (GTK_RANGE (scale)) )); Return the expected GObject * type. This was not fixed upstream before this file was removed. diff --git a/gtk/gtkuimanager.c b/gtk/gtkuimanager.c index d004cf1ed3a2be11..8cbeda9e85b8f460 100644 --- a/gtk/gtkuimanager.c +++ b/gtk/gtkuimanager.c @@ -503,7 +503,7 @@ gtk_ui_manager_buildable_construct_child (GtkBuildable *buildable, g_signal_connect (widget, "hierarchy-changed", G_CALLBACK (child_hierarchy_changed_cb), GTK_UI_MANAGER (buildable)); - return g_object_ref (widget); + return G_OBJECT (g_object_ref (widget)); } static void Part of this commit upstream: commit ca94ff10ce2ea57bfde7692aaa558b1260c9ff75 Author: Daniel Boles Date: Fri Jun 29 20:00:06 2018 +0100 testsuite/gtk/defaultvalue: Actually build...& fix It looks like this got dropped during the move from autotools and never restored. I can see why, since making it work wasn't a hugely fun task! Notes on some less then obvious details: * PlacesSidebar is private now and didn't seem to be to be particularly easy to adapt to, so this moves to checking for it by name, not TYPE. I couldn't find a (fast) better way; if you know how, please clean up * added 2 casts to avoid warnings from the new type-propagating ref() * GdkClipboard and GdkContentProvider need some properties dodged * GtkToolItemGroup is gone * fixed indentation and used TypeName:property-name syntax in a print() diff --git a/gtk/tests/defaultvalue.c b/gtk/tests/defaultvalue.c index 64a113c955822af0..b78dcd6f59353102 100644 --- a/gtk/tests/defaultvalue.c +++ b/gtk/tests/defaultvalue.c @@ -91,13 +91,13 @@ test_type (gconstpointer data) klass = g_type_class_ref (type); if (g_type_is_a (type, GTK_TYPE_SETTINGS)) - instance = g_object_ref (gtk_settings_get_default ()); + instance = G_OBJECT (g_object_ref (gtk_settings_get_default ())); else if (g_type_is_a (type, GDK_TYPE_PANGO_RENDERER)) - instance = g_object_ref (gdk_pango_renderer_get_default (gdk_screen_get_default ())); + instance = G_OBJECT (g_object_ref (gdk_pango_renderer_get_default (gdk_screen_get_default ()))); else if (g_type_is_a (type, GDK_TYPE_PIXMAP)) - instance = g_object_ref (gdk_pixmap_new (NULL, 1, 1, 1)); + instance = G_OBJECT (g_object_ref (gdk_pixmap_new (NULL, 1, 1, 1))); else if (g_type_is_a (type, GDK_TYPE_COLORMAP)) - instance = g_object_ref (gdk_colormap_new (gdk_visual_get_best (), TRUE)); + instance = G_OBJECT (g_object_ref (gdk_colormap_new (gdk_visual_get_best (), TRUE))); else if (g_type_is_a (type, GDK_TYPE_WINDOW)) { GdkWindowAttr attributes; @@ -105,7 +105,7 @@ test_type (gconstpointer data) attributes.event_mask = 0; attributes.width = 100; attributes.height = 100; - instance = g_object_ref (gdk_window_new (NULL, &attributes, 0)); + instance = G_OBJECT (g_object_ref (gdk_window_new (NULL, &attributes, 0))); } else instance = g_object_new (type, NULL); Convert to the expected pointer. This was not fixed before the file was removed upstream. diff --git a/modules/other/gail/gailtreeview.c b/modules/other/gail/gailtreeview.c index 23923c59a16a6efb..ac6ff0a1c4a2fe22 100644 --- a/modules/other/gail/gailtreeview.c +++ b/modules/other/gail/gailtreeview.c @@ -995,7 +995,7 @@ gail_tree_view_ref_child (AtkObject *obj, gail_cell_add_state (cell, ATK_STATE_FOCUSABLE, FALSE); if (focus_index == i) { - gailview->focus_cell = g_object_ref (cell); + gailview->focus_cell = ATK_OBJECT (g_object_ref (cell)); gail_cell_add_state (cell, ATK_STATE_FOCUSED, FALSE); g_signal_emit_by_name (gailview, "active-descendant-changed", https://gitlab.gnome.org/GNOME/gtk/-/issues/6786 CVE-2024-6655 Comment by Dimitrios Glynos: I will make a note to mention in the advisory that this would be exploitable in a GTK-2 application if a platform had for some reason referenced a non-existent GTK-2 module in the GTK_MODULES environment variable. Failure to load a module can be non-fatal to GTK applications, so the existence of such a problematic environment variable might have gone undetected. I did not mention this in my report as GTK-2 is unsupported and I had not come across any platform doing something like this. The potential for exploitation of the issue against a GTK-2 application on a random system is very very low. https://gitlab.gnome.org/GNOME/gtk/-/commit/3bbf0b6176d42836d23c36a6ac410e807ec0a7a7 Backported by me (I pasted from the gitlab html, not sure if the line numbers have changed). diff -Naur a/gtk/gtkmodules.c b/gtk/gtkmodules.c --- a/gtk/gtkmodules.c 2020-12-18 05:29:40.000000000 +0000 +++ b/gtk/gtkmodules.c 2024-07-11 19:40:32.213732243 +0100 @@ -229,13 +229,8 @@ gchar *module_name; module_name = _gtk_find_module (name, "modules"); - if (!module_name) - { - /* As last resort, try loading without an absolute path (using system - * library path) - */ - module_name = g_module_build_path (NULL, name); - } + if (module_name == NULL) + return NULL; module = g_module_open (module_name, G_MODULE_BIND_LOCAL | G_MODULE_BIND_LAZY);