[PATCH libinput 1/2] Fix a crash when requesting invalid mode group indices

Peter Hutterer peter.hutterer at who-t.net
Fri Feb 24 04:41:25 UTC 2017


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-tablet-pad-leds.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/evdev-tablet-pad-leds.c b/src/evdev-tablet-pad-leds.c
index 209ab73..89b3b9d 100644
--- a/src/evdev-tablet-pad-leds.c
+++ b/src/evdev-tablet-pad-leds.c
@@ -645,5 +645,9 @@ evdev_device_tablet_pad_get_mode_group(struct evdev_device *device,
 	if (!(device->seat_caps & EVDEV_DEVICE_TABLET_PAD))
 		return NULL;
 
+	if (index >=
+	    (unsigned int)evdev_device_tablet_pad_get_num_mode_groups(device))
+		return NULL;
+
 	return pad_get_mode_group(pad, index);
 }
-- 
2.9.3



More information about the wayland-devel mailing list