[PATCH 3/7] dix: don't allow keyboard devices to submit motion or button events.

Peter Hutterer peter.hutterer at who-t.net
Thu Sep 1 03:41:26 PDT 2011


GPE unconditionally dereferences pDev->valuator if a mask is present. This
shouldn't really happen but if it does, don't crash, just ignore the events
with an error.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 dix/getevents.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/dix/getevents.c b/dix/getevents.c
index 511c96c..08c6269 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1158,6 +1158,11 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons
     switch (type)
     {
         case MotionNotify:
+            if (!pDev->valuator)
+            {
+                ErrorF("[dix] motion events from device %d without valuators\n", pDev->id);
+                return 0;
+            }
             if (!mask_in || valuator_mask_num_valuators(mask_in) <= 0)
                 return 0;
             break;
@@ -1165,6 +1170,11 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons
         case ButtonRelease:
             if (!pDev->button || !buttons)
                 return 0;
+            if (valuator_mask_size(mask_in) > 0 && !pDev->valuator)
+            {
+                ErrorF("[dix] button event with valuator from device %d without valuators\n", pDev->id);
+                return 0;
+            }
             break;
         default:
             return 0;
-- 
1.7.6



More information about the xorg-devel mailing list