From bce4c87232bea82560725fa44e079088d75a367f Mon Sep 17 00:00:00 2001 From: Damien Lespiau Date: Fri, 19 Nov 2010 14:19:52 -0500 Subject: [PATCH] evdev: Don't oveflow when translating buttons to masks An array is used to translate the button to its mask. Clutter defines the masks for button 1 to 5 but we report BTN_LEFT..BTN_TASK ie 0x110..0x117. We need to pad the array for the translation not to access random data for buttons between 0x115 and 0x117. --- clutter/evdev/clutter-device-manager-evdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clutter/evdev/clutter-device-manager-evdev.c b/clutter/evdev/clutter-device-manager-evdev.c index ab2dfca00..7e120934e 100644 --- a/clutter/evdev/clutter-device-manager-evdev.c +++ b/clutter/evdev/clutter-device-manager-evdev.c @@ -219,10 +219,10 @@ notify_button (ClutterEventSource *source, ClutterEvent *event; ClutterActor *stage; gint button_nr; - static gint maskmap[5] = + static gint maskmap[8] = { CLUTTER_BUTTON1_MASK, CLUTTER_BUTTON2_MASK, CLUTTER_BUTTON3_MASK, - CLUTTER_BUTTON4_MASK, CLUTTER_BUTTON5_MASK + CLUTTER_BUTTON4_MASK, CLUTTER_BUTTON5_MASK, 0, 0, 0 }; stage = clutter_stage_get_default ();