mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-04-16 12:10:43 +02:00
plugin: guard against unsigned underflow in plugin_has_mask
nevents should never be zero but let's prevent against an underflow, if only to make the analyzers happy. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1465>
This commit is contained in:
parent
8c06ceecb2
commit
aa04f67b1c
1 changed files with 3 additions and 0 deletions
|
|
@ -726,6 +726,9 @@ plugin_has_mask(struct libinput_plugin *plugin, struct evdev_frame *frame)
|
|||
size_t nevents;
|
||||
struct evdev_event *events = evdev_frame_get_events(frame, &nevents);
|
||||
|
||||
if (nevents == 0)
|
||||
return false;
|
||||
|
||||
/* nevents - 1 because we don't check the SYN_REPORT */
|
||||
for (size_t i = 0; i < nevents - 1; i++) {
|
||||
struct evdev_event *e = &events[i];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue