mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-03-22 04:30:41 +01:00
tablet: avoid errors calling libevdev_get_abs_info()
Commit 806d4a1393 ("tablet: check libevdev_get_abs_info() return
value") prevented a crash when tilt was deactivated by a quirk.
For more information check [1].
Add similar checks before calling libevdev_get_abs_info() to avoid
possible crashes.
[1] https://gitlab.freedesktop.org/libinput/libinput/-/issues/805
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
This commit is contained in:
parent
7d29e2d616
commit
640208531c
1 changed files with 16 additions and 0 deletions
|
|
@ -455,6 +455,10 @@ tablet_update_xy(struct tablet_dispatch *tablet,
|
|||
const struct input_absinfo *absinfo;
|
||||
int value;
|
||||
|
||||
if (!libevdev_has_event_code(device->evdev, EV_ABS, ABS_X) ||
|
||||
!libevdev_has_event_code(device->evdev, EV_ABS, ABS_Y))
|
||||
return;
|
||||
|
||||
if (bit_is_set(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_X) ||
|
||||
bit_is_set(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_Y)) {
|
||||
absinfo = libevdev_get_abs_info(device->evdev, ABS_X);
|
||||
|
|
@ -528,6 +532,9 @@ tablet_update_pressure(struct tablet_dispatch *tablet,
|
|||
{
|
||||
const struct input_absinfo *absinfo;
|
||||
|
||||
if (!libevdev_has_event_code(device->evdev, EV_ABS, ABS_PRESSURE))
|
||||
return;
|
||||
|
||||
if (bit_is_set(tablet->changed_axes,
|
||||
LIBINPUT_TABLET_TOOL_AXIS_PRESSURE)) {
|
||||
absinfo = libevdev_get_abs_info(device->evdev, ABS_PRESSURE);
|
||||
|
|
@ -541,6 +548,9 @@ tablet_update_distance(struct tablet_dispatch *tablet,
|
|||
{
|
||||
const struct input_absinfo *absinfo;
|
||||
|
||||
if (!libevdev_has_event_code(device->evdev, EV_ABS, ABS_DISTANCE))
|
||||
return;
|
||||
|
||||
if (bit_is_set(tablet->changed_axes,
|
||||
LIBINPUT_TABLET_TOOL_AXIS_DISTANCE)) {
|
||||
absinfo = libevdev_get_abs_info(device->evdev, ABS_DISTANCE);
|
||||
|
|
@ -554,6 +564,9 @@ tablet_update_slider(struct tablet_dispatch *tablet,
|
|||
{
|
||||
const struct input_absinfo *absinfo;
|
||||
|
||||
if (!libevdev_has_event_code(device->evdev, EV_ABS, ABS_WHEEL))
|
||||
return;
|
||||
|
||||
if (bit_is_set(tablet->changed_axes,
|
||||
LIBINPUT_TABLET_TOOL_AXIS_SLIDER)) {
|
||||
absinfo = libevdev_get_abs_info(device->evdev, ABS_WHEEL);
|
||||
|
|
@ -597,6 +610,9 @@ tablet_update_artpen_rotation(struct tablet_dispatch *tablet,
|
|||
{
|
||||
const struct input_absinfo *absinfo;
|
||||
|
||||
if (!libevdev_has_event_code(device->evdev, EV_ABS, ABS_Z))
|
||||
return;
|
||||
|
||||
if (bit_is_set(tablet->changed_axes,
|
||||
LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z)) {
|
||||
absinfo = libevdev_get_abs_info(device->evdev,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue