aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2019-02-28 18:58:02 +0100
committerBrian Ashworth <bosrsf04@gmail.com>2019-02-28 23:00:57 -0500
commit4135fafecd5c9a8daafb0caec96089cfa0926c6e (patch)
treefa693e210dae6d24951a3ab8c50f3e5b268835a7
parentf8fcd7f06a0da04d55316033d5e484815c139ce0 (diff)
seat: guard against button count corruption
This is still a compositor bug, and bad events will be sent to clients. We'll need to track each button separately to handle this in wlroots.
-rw-r--r--types/seat/wlr_seat_pointer.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/types/seat/wlr_seat_pointer.c b/types/seat/wlr_seat_pointer.c
index d03385cf..e473d9b3 100644
--- a/types/seat/wlr_seat_pointer.c
+++ b/types/seat/wlr_seat_pointer.c
@@ -346,7 +346,11 @@ uint32_t wlr_seat_pointer_notify_button(struct wlr_seat *wlr_seat,
}
wlr_seat->pointer_state.button_count++;
} else {
- wlr_seat->pointer_state.button_count--;
+ if (wlr_seat->pointer_state.button_count == 0) {
+ wlr_log(WLR_ERROR, "Corrupted seat button count");
+ } else {
+ wlr_seat->pointer_state.button_count--;
+ }
}
struct wlr_seat_pointer_grab *grab = wlr_seat->pointer_state.grab;