wayland: Avoid using uninitialized memory

_gdk_wayland_cursor_get_buffer was not initializing
its out variables in the 'not found' case. This
was showing up in protocol traces as garbage hotspots
being sent to the compositor.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1328
This commit is contained in:
Matthias Clasen
2019-04-18 14:22:48 +00:00
parent 5cd8e0f7f1
commit ecdad20827

View File

@@ -169,14 +169,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
struct wl_cursor *c;
if (g_str_equal (gdk_cursor_get_name (cursor), "none"))
{
*hotspot_x = 0;
*hotspot_y = 0;
*width = 0;
*height = 0;
*scale = 1;
return NULL;
}
goto none;
c = gdk_wayland_cursor_load_for_name (display,
_gdk_wayland_display_get_scaled_cursor_theme (display, desired_scale),
@@ -250,6 +243,13 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
width, height,
scale);
none:
*hotspot_x = 0;
*hotspot_y = 0;
*width = 0;
*height = 0;
*scale = 1;
return NULL;
}