fallback: Fix ubsan runtime error

Running libinput-test-suite with -fsanitize=undefined highlights the two
following errors. Force C to realize we want an unsigned result by making
the '1' literal unsigned.

../src/evdev-fallback.c:314:22 runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
../src/evdev-fallback.c:377:24 runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

v2: use bit() instead of manual shift 1U<<1

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit f589f4968f)
This commit is contained in:
Jason Gerecke 2019-04-10 09:55:25 -07:00 committed by Peter Hutterer
parent 0488af4b90
commit c13567bb68

View file

@ -311,7 +311,7 @@ fallback_flush_mt_down(struct fallback_dispatch *dispatch,
if (seat_slot == -1)
return false;
seat->slot_map |= 1 << seat_slot;
seat->slot_map |= bit(seat_slot);
point = slot->point;
slot->hysteresis_center = point;
evdev_transform_absolute(device, &point);
@ -374,7 +374,7 @@ fallback_flush_mt_up(struct fallback_dispatch *dispatch,
if (seat_slot == -1)
return false;
seat->slot_map &= ~(1 << seat_slot);
seat->slot_map &= ~bit(seat_slot);
touch_notify_touch_up(base, time, slot_idx, seat_slot);
@ -402,7 +402,7 @@ fallback_flush_mt_cancel(struct fallback_dispatch *dispatch,
if (seat_slot == -1)
return false;
seat->slot_map &= ~(1 << seat_slot);
seat->slot_map &= ~bit(seat_slot);
touch_notify_touch_cancel(base, time, slot_idx, seat_slot);
@ -434,7 +434,7 @@ fallback_flush_st_down(struct fallback_dispatch *dispatch,
if (seat_slot == -1)
return false;
seat->slot_map |= 1 << seat_slot;
seat->slot_map |= bit(seat_slot);
point = dispatch->abs.point;
evdev_transform_absolute(device, &point);
@ -484,7 +484,7 @@ fallback_flush_st_up(struct fallback_dispatch *dispatch,
if (seat_slot == -1)
return false;
seat->slot_map &= ~(1 << seat_slot);
seat->slot_map &= ~bit(seat_slot);
touch_notify_touch_up(base, time, -1, seat_slot);
@ -509,7 +509,7 @@ fallback_flush_st_cancel(struct fallback_dispatch *dispatch,
if (seat_slot == -1)
return false;
seat->slot_map &= ~(1 << seat_slot);
seat->slot_map &= ~bit(seat_slot);
touch_notify_touch_cancel(base, time, -1, seat_slot);