aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar A. M. Joseph <adam@westerntelegraphic.net>2019-10-16 23:55:40 -0700
committerLibravatar Simon Ser <contact@emersion.fr>2019-10-17 11:40:16 +0300
commit74c0e7921ae13986eb7d79bfa263f7ddb9312440 (patch)
tree02eea2824a322934758a99cf0e82bff2826105e0 /sway
parentUpdates per wlroots layer shell changes (diff)
downloadsway-74c0e7921ae13986eb7d79bfa263f7ddb9312440.tar.gz
sway-74c0e7921ae13986eb7d79bfa263f7ddb9312440.tar.zst
sway-74c0e7921ae13986eb7d79bfa263f7ddb9312440.zip
xwayland.c handle_map(): NULL out xsurface->data() to prevent crashing.
When changing a surface from managed to unmanaged in handle_map(), the call to handle_destroy(.., view) causes the sway_xwayland_view pointed to by the untyped wlr_xwayland_surface.data field to become invalid garbage, yet the untyped wlr_xwayland_surface.data continues to point at it. In particular: view_get_*(view_from_wlr_surface(..)), even with appropriate NULL checking, will crash sway when this codepath is exercised (reliable test case: drop-down menus in Google Earth).
Diffstat (limited to 'sway')
-rw-r--r--sway/desktop/xwayland.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 0f708201..28d7c058 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -401,6 +401,7 @@ static void handle_map(struct wl_listener *listener, void *data) {
401 // This window used not to have the override redirect flag and has it 401 // This window used not to have the override redirect flag and has it
402 // now. Switch to unmanaged. 402 // now. Switch to unmanaged.
403 handle_destroy(&xwayland_view->destroy, view); 403 handle_destroy(&xwayland_view->destroy, view);
404 xsurface->data = NULL;
404 struct sway_xwayland_unmanaged *unmanaged = create_unmanaged(xsurface); 405 struct sway_xwayland_unmanaged *unmanaged = create_unmanaged(xsurface);
405 unmanaged_handle_map(&unmanaged->map, xsurface); 406 unmanaged_handle_map(&unmanaged->map, xsurface);
406 return; 407 return;