From aef84f0e4d506dda18992f0213e3233a4ed2ac20 Mon Sep 17 00:00:00 2001 From: David96 Date: Sun, 2 Feb 2025 20:47:56 +0100 Subject: [PATCH] wlr_virtual_pointer: Set axis source on all axis Currently it is possible to crash a wlroots compositor by setting any axis source other than 0 and sending an axis event in the HORIZONTAL direction from wlr_virtual_pointer since the axis source is only set on the first axis. This then hits the assert in wlr_seat_pointer.c:332. Fix by always setting the source on all axis. --- types/wlr_virtual_pointer_v1.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/types/wlr_virtual_pointer_v1.c b/types/wlr_virtual_pointer_v1.c index b867c8fb1..fed5790a9 100644 --- a/types/wlr_virtual_pointer_v1.c +++ b/types/wlr_virtual_pointer_v1.c @@ -134,8 +134,11 @@ static void virtual_pointer_axis_source(struct wl_client *client, if (pointer == NULL) { return; } - pointer->axis_event[pointer->axis].pointer = &pointer->pointer; - pointer->axis_event[pointer->axis].source = source; + int n_axis = sizeof(pointer->axis_event) / sizeof(pointer->axis_event[0]); + for (int i = 0; i < n_axis; i++) { + pointer->axis_event[i].pointer = &pointer->pointer; + pointer->axis_event[i].source = source; + } } static void virtual_pointer_axis_stop(struct wl_client *client,