diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2016-10-21 09:42:23 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2016-10-24 08:27:24 +1000 |
commit | 7251e42dfbac11eb1619b0a3881ee463b6d76c95 (patch) | |
tree | f869fe2c2ba7e8d6112bfb2772b43a63f2337a43 | |
parent | 551db5b86e2a19e027e57571b8e5405dacb8bd67 (diff) |
Fix off-by-one error counting axes
We stopped counting one too early, but still initialized that axis later,
leading to a bug macro to trigger.
https://bugs.freedesktop.org/show_bug.cgi?id=97956
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r-- | src/evdev.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/evdev.c b/src/evdev.c index 5ace238..96fd97d 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1238,7 +1238,7 @@ EvdevCountMTAxes(EvdevPtr pEvdev, int *num_mt_axes_total, return; /* Absolute multitouch axes: adjust mapping and axes counts. */ - for (axis = ABS_MT_SLOT; axis < ABS_MAX; axis++) + for (axis = ABS_MT_SLOT; axis <= ABS_MAX; axis++) { int j; Bool skip = FALSE; @@ -1288,7 +1288,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int num_scroll_axes) goto out; /* Find number of absolute axis, including MT ones, will decrease later. */ - for (i = 0; i < ABS_MAX; i++) + for (i = 0; i <= ABS_MAX; i++) if (libevdev_has_event_code(pEvdev->dev, EV_ABS, i)) num_axes++; @@ -1456,7 +1456,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int num_scroll_axes) } for (i = 0; i < num_touches; i++) { - for (axis = ABS_MT_TOUCH_MAJOR; axis < ABS_MAX; axis++) { + for (axis = ABS_MT_TOUCH_MAJOR; axis <= ABS_MAX; axis++) { if (pEvdev->abs_axis_map[axis] >= 0) { int val = pEvdev->mtdev ? 0 : libevdev_get_current_slot(pEvdev->dev); /* XXX: read initial values from mtdev when it adds support @@ -1669,7 +1669,7 @@ EvdevAddRelValuatorClass(DeviceIntPtr device, int num_scroll_axes) if (!libevdev_has_event_type(pEvdev->dev, EV_REL)) goto out; - for (i = 0; i < REL_MAX; i++) { + for (i = 0; i <= REL_MAX; i++) { if (i == REL_WHEEL || i == REL_HWHEEL || i == REL_DIAL) continue; |