From: José Expósito Date: Mon, 12 Sep 2022 16:28:38 +0000 (+0200) Subject: tablet: check libevdev_get_abs_info() return value X-Git-Tag: 1.22.0~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=806d4a1393db6b64bc596f60f112182586c4fa12;p=platform%2Fupstream%2Flibinput.git tablet: check libevdev_get_abs_info() return value Commit b5f0536a4f93 ("quirks: add a quirk for the Wacom 524c device") added the quirk "AttrEventCodeDisable=ABS_TILT_X;ABS_TILT_Y;" to the Wacom 524c. When using the pen in a display with tilt support, the tilt X/Y axes are set as changed. Using the pen again, but this time in the display without tilt support, will try to get the tilt information, crashing. Check the return value of libevdev_get_abs_info() to avoid this crash. Fix https://gitlab.freedesktop.org/libinput/libinput/-/issues/805 Fixes: b5f0536a4f93 ("quirks: add a quirk for the Wacom 524c device") Signed-off-by: José Expósito --- diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index 62c23b83..6094bd53 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -567,6 +567,10 @@ tablet_update_tilt(struct tablet_dispatch *tablet, { const struct input_absinfo *absinfo; + if (!libevdev_has_event_code(device->evdev, EV_ABS, ABS_TILT_X) || + !libevdev_has_event_code(device->evdev, EV_ABS, ABS_TILT_Y)) + return; + /* mouse rotation resets tilt to 0 so always fetch both axes if * either has changed */ if (bit_is_set(tablet->changed_axes,