From c6e2af1155257f92857bbd05ac4d721a86c4cc5a Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 22 May 2026 20:10:12 +0200 Subject: [PATCH] xwayland/xwm: check object type in xwm_handle_surface_id_message() wlr_surface_from_resource() asserts that the object is a wl_surface. Since arbitrary clients can send such messages, avoid aborting on invalid input. Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/work_items/4093 --- xwayland/xwm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 59c37db48..8ffe7697e 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -1480,6 +1480,13 @@ static void xwm_handle_surface_id_message(struct wlr_xwm *xwm, struct wl_resource *resource = wl_client_get_object(xwm->xwayland->server->client, id); if (resource) { + if (wl_resource_get_interface(resource) != &wl_surface_interface) { + wlr_log(WLR_DEBUG, "Received client message WL_SURFACE_ID " + "for X11 window %u but Wayland object is not a wl_surface", + ev->window); + return; + } + struct wlr_surface *surface = wlr_surface_from_resource(resource); xwayland_surface_associate(xwm, xsurface, surface); } else {