summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-05-11 12:27:39 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-05-15 14:09:42 +1000
commit77d766b1d535dff9a27c7db343ede85d9f44850b (patch)
tree91fc1c682bff6ebb141b4db5cca7406fd312e544 /src
parent0352c67fa2a7224b5a3bf03a934b3c7af42b4f51 (diff)
Avoid out-of-bounds access by running num_active_touches < 0 (#49439)
If a touch is active during driver init, the slot will be set to SLOTSTATE_CLOSE when it finishes. That could decrease num_active_touches to less than 0, causing out-of-bounds access. X.Org Bug 49439 <http://bugs.freedesktop.org/show_bug.cgi?id=49439> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'src')
-rw-r--r--src/synaptics.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/synaptics.c b/src/synaptics.c
index e792977..ff47857 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2624,7 +2624,9 @@ UpdateTouchState(InputInfoPtr pInfo, struct SynapticsHwState *hw)
priv->open_slots[j] = priv->open_slots[j + 1];
}
- priv->num_active_touches--;
+ BUG_WARN(priv->num_active_touches == 0);
+ if (priv->num_active_touches > 0)
+ priv->num_active_touches--;
}
}