[mutter] backends/x11: Prevent segfault when querying list of devices



commit 8493777961f97b013cced413536938354d7c4f63
Author: Jason Gerecke <killertofu gmail com>
Date:   Mon Sep 11 11:51:44 2017 -0700

    backends/x11: Prevent segfault when querying list of devices
    
    The XIQueryDevice function used by device_query_area can return a NULL
    pointer and set n_devices to a negative number in some cases. We add
    additional checks to prevent a segfault.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=787649

 src/backends/x11/meta-input-settings-x11.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
index c833296..98d05a9 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -589,7 +589,7 @@ device_query_area (ClutterInputDevice *device,
   *width = *height = 0;
   device_id = clutter_input_device_get_device_id (device);
   info = XIQueryDevice (xdisplay, device_id, &n_devices);
-  if (n_devices == 0)
+  if (n_devices <= 0 || !info)
     return FALSE;
 
   abs_x = XInternAtom (xdisplay, "Abs X", True);


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