From: Daniel Boles Date: Sun, 11 Jun 2023 10:37:45 +0000 (+0100) Subject: Popover: Clarify/guard out rect of get_pointing_to X-Git-Tag: archive/raspbian/3.24.39-1+rpi1~35 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=437ee63f38aa8ff0d8d7b144a5800bc957a97edb;p=gtk%2B3.0.git Popover: Clarify/guard out rect of get_pointing_to Clarify that we zero out the widget coords and only keep its dimensions. If we have no widget to fall-back to, memset to 0 the output @rect since we return FALSE whether or not we have widget, so protect users from not knowing if there was a widget and possibly accessing uninitialised ints. Bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/893#note_1766079 Origin: 3.24.39, commit:a6d40b610be6acb635d8732c11bb6d866bf2e95d Gbp-Pq: Name Popover-Clarify-guard-out-rect-of-get_pointing_to.patch --- diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c index 82ad2fc291..b812e0e568 100644 --- a/gtk/gtkpopover.c +++ b/gtk/gtkpopover.c @@ -112,6 +112,7 @@ #include "gtkstylecontextprivate.h" #include "gtkprogresstrackerprivate.h" #include "gtksettingsprivate.h" +#include /* memset */ #ifdef GDK_WINDOWING_WAYLAND #include "wayland/gdkwayland.h" @@ -2316,7 +2317,7 @@ gtk_popover_set_pointing_to (GtkPopover *popover, * If a rectangle to point to has been set, this function will * return %TRUE and fill in @rect with such rectangle, otherwise * it will return %FALSE and fill in @rect with the attached - * widget coordinates. + * widget width and height if a widget exists, otherwise it will zero-out @rect. * * Returns: %TRUE if a rectangle to point to was set. **/ @@ -2336,6 +2337,8 @@ gtk_popover_get_pointing_to (GtkPopover *popover, gtk_widget_get_allocation (priv->widget, rect); rect->x = rect->y = 0; } + else + memset (rect, 0, sizeof (GdkRectangle)); return priv->has_pointing_to; }