Add missing return after scroll capability checks

For both ei/eis a missing return after the scroll capability check could
cause a potential NULL pointer dereference on device->scroll.

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/382>
This commit is contained in:
Peter Hutterer 2026-03-11 15:15:55 +10:00 committed by Marge Bot
parent d0b5180a88
commit b4f45f2aff
2 changed files with 8 additions and 0 deletions

View file

@ -1466,6 +1466,7 @@ ei_device_scroll_delta(struct ei_device *device, double x, double y)
if (!ei_device_has_capability(device, EI_DEVICE_CAP_SCROLL)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not scroll device", __func__);
return;
}
if (device->state != EI_DEVICE_STATE_EMULATING) {
@ -1486,6 +1487,7 @@ ei_device_scroll_stop(struct ei_device *device, bool x, bool y)
if (!ei_device_has_capability(device, EI_DEVICE_CAP_SCROLL)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not scroll device", __func__);
return;
}
if (device->state != EI_DEVICE_STATE_EMULATING) {
@ -1515,6 +1517,7 @@ ei_device_scroll_cancel(struct ei_device *device, bool x, bool y)
if (!ei_device_has_capability(device, EI_DEVICE_CAP_SCROLL)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not scroll device", __func__);
return;
}
if (device->state != EI_DEVICE_STATE_EMULATING) {
@ -1548,6 +1551,7 @@ ei_device_scroll_discrete(struct ei_device *device, int32_t x, int32_t y)
if (!ei_device_has_capability(device, EI_DEVICE_CAP_SCROLL)) {
log_bug_client(ei_device_get_context(device),
"%s: device is not scroll device", __func__);
return;
}
if (device->state != EI_DEVICE_STATE_EMULATING) {

View file

@ -1234,6 +1234,7 @@ eis_device_scroll_delta(struct eis_device *device, double x, double y)
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_SCROLL)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a scroll device", __func__);
return;
}
if (device->state != EIS_DEVICE_STATE_EMULATING)
@ -1252,6 +1253,7 @@ eis_device_scroll_stop(struct eis_device *device, bool x, bool y)
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_SCROLL)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a scroll device", __func__);
return;
}
if (device->state != EIS_DEVICE_STATE_EMULATING)
@ -1280,6 +1282,7 @@ eis_device_scroll_cancel(struct eis_device *device, bool x, bool y)
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_SCROLL)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a scroll device", __func__);
return;
}
if (device->state != EIS_DEVICE_STATE_EMULATING)
@ -1312,6 +1315,7 @@ eis_device_scroll_discrete(struct eis_device *device, int32_t x, int32_t y)
if (!eis_device_has_capability(device, EIS_DEVICE_CAP_SCROLL)) {
log_bug_client(eis_device_get_context(device),
"%s: device is not a scroll device", __func__);
return;
}
if (device->state != EIS_DEVICE_STATE_EMULATING)