Commit 746d74b140c5ec0b85d23738081d77963c9dd245

Frank Praznik 2023-10-29T14:23:14

wayland: Sanity check pointers and protocols before confining (cherry picked from commit 875e45e70b4086ca8cdff405231fc616f06cda7e) (cherry picked from commit 60e8ff16dc147780c7ffee030adc870b9e6042d1)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index 216ae54..65adff6 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -2534,6 +2534,10 @@ static void lock_pointer_to_window(SDL_Window *window,
     SDL_VideoData *d = input->display;
     struct zwp_locked_pointer_v1 *locked_pointer;
 
+    if (!d->pointer_constraints || !input->pointer) {
+        return;
+    }
+
     if (w->locked_pointer) {
         return;
     }