summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2021-03-22 13:55:34 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2021-04-07 12:38:25 +1000
commit95a72990ad71285b834646210c5a483baabd4b4e (patch)
treeb1512eb3af856c438dd40f973b4b240083104991
parentf723b28220adc64552c4ce26c4c9054494ea0141 (diff)
downloadlibinput-95a72990ad71285b834646210c5a483baabd4b4e.tar.gz
evdev: don't check the event time if it's higher than the dispatch time
The dispatch time is taken during libinput_dispatch(), i.e. at the beginning of an event sequence. We always read all events off the device, so where events come in while we're inside the main dispatch loop, our event time may be later than the saved dispatch_time. This causes an uint underflow and our tdelta > 10 will be true for that case. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/evdev.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/evdev.c b/src/evdev.c
index d792e8aa..14796e83 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1024,6 +1024,7 @@ evdev_note_time_delay(struct evdev_device *device,
{
struct libinput *libinput = evdev_libinput_context(device);
uint32_t tdelta;
+ uint32_t eventtime = input_event_time(ev);
/* if we have a current libinput_dispatch() snapshot, compare our
* event time with the one from the snapshot. If we have more than
@@ -1031,10 +1032,11 @@ evdev_note_time_delay(struct evdev_device *device,
* where there is no steady event flow and thus SYN_DROPPED may not
* get hit by the kernel despite us being too slow.
*/
- if (libinput->dispatch_time == 0)
+ if (libinput->dispatch_time == 0 ||
+ eventtime > libinput->dispatch_time)
return;
- tdelta = us2ms(libinput->dispatch_time - input_event_time(ev));
+ tdelta = us2ms(libinput->dispatch_time - eventtime);
if (tdelta > 10) {
evdev_log_bug_client_ratelimit(device,
&device->delay_warning_limit,