[gtk/wayland-hotspot-3] wayland: Avoid using uninitialized memory



commit ac739b2a72944c25b813e641bb6c06bdc046b596
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Apr 18 10:40:09 2019 -0400

    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

 gdk/wayland/gdkcursor-wayland.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/gdk/wayland/gdkcursor-wayland.c b/gdk/wayland/gdkcursor-wayland.c
index 0212d70a7e..a976c4819a 100644
--- a/gdk/wayland/gdkcursor-wayland.c
+++ b/gdk/wayland/gdkcursor-wayland.c
@@ -259,6 +259,14 @@ _gdk_wayland_cursor_get_buffer (GdkCursor *cursor,
       if (wayland_cursor->surface.cairo_surface)
         return _gdk_wayland_shm_surface_get_wl_buffer (wayland_cursor->surface.cairo_surface);
     }
+  else
+    {
+      *hotspot_x = 0;
+      *hotspot_y = 0;
+      *w = 0;
+      *h = 0;
+      *scale = 1;
+    }
 
   return NULL;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]