[PATCH xserver-xorg-input-synaptics] Check touch record bounds before access

Chase Douglas chase.douglas at canonical.com
Mon Apr 9 11:38:16 PDT 2012


We guess ten simultaneous touches if the device does not tell us. The
Linux drivers for the Apple multitouch trackpads do not tell the number
of simultaneous touches, but they can do more than ten. When this
occurs, the array index into the touch records will be invalid. We must
not process the touch or else we will segfault.

Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
 src/eventcomm.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/eventcomm.c b/src/eventcomm.c
index 3ceb98c..9d1233c 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -564,6 +564,9 @@ EventProcessTouchEvent(InputInfoPtr pInfo, struct SynapticsHwState *hw,
     {
         int slot_index = last_mt_vals_slot(priv);
 
+        if (slot_index < 0)
+            return;
+
         if (hw->slot_state[slot_index] == SLOTSTATE_EMPTY ||
             hw->slot_state[slot_index] == SLOTSTATE_OPEN_EMPTY)
             hw->slot_state[slot_index] = SLOTSTATE_UPDATE;
-- 
1.7.9.1



More information about the xorg-devel mailing list