]> git.mdlowis.com Git - proto/labwc.git/commit
xwayland: do not set xsurface->data for unmanaged surface
authorJohn Lindgren <john@jlindgren.net>
Sat, 30 Sep 2023 05:31:37 +0000 (01:31 -0400)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Sat, 30 Sep 2023 18:32:26 +0000 (20:32 +0200)
commit1c785d74c1b70a495a406b05c347060269c327b7
treecd87e7c707ad83842c3d5b32f76428b55ecd3372
parent2e8820cf6ac90dbf26cfe3f21742a72447c6fad4
xwayland: do not set xsurface->data for unmanaged surface

xsurface->data is presumed to be a (struct view *) if set, so it must be
left NULL for an unmanaged surface. Otherwise view_from_wlr_surface()
may return a (struct xwayland_unmanaged *) where a (struct view *) was
expected, leading to a crash.

valgrind backtrace:

    Invalid read of size 1
      at 0x48F8FFC: wlr_scene_node_set_enabled (wlr_scene.c:903)
      by 0x124C9F: ssd_set_active (ssd.c:323)
      by 0x124C9F: ssd_set_active (ssd.c:318)
      by 0x124C9F: view_set_activated (view.c:215)
      by 0x118851: focus_change_notify (seat.c:353)
      by 0x487E01D: wl_signal_emit_mutable (wayland-server.c:2241)
      by 0x48FC8F2: wlr_seat_keyboard_enter (wlr_seat_keyboard.c:298)
      by 0x119E60: seat_focus.lto_priv.0 (seat.c:473)
      by 0x1248FD: seat_focus_surface (seat.c:491)
      by 0x1248FD: unmanaged_handle_map (xwayland-unmanaged.c:51)
      by 0x487E01D: wl_signal_emit_mutable (wayland-server.c:2241)
      by 0x487E01D: wl_signal_emit_mutable (wayland-server.c:2241)
      by 0x490FC91: surface_commit_state (wlr_compositor.c:499)
      by 0x56A24F5: ffi_call_unix64 (unix64.S:104)
      by 0x569EF5D: ffi_call_int.lto_priv.0 (ffi64.c:673)
    Address 0xa0e15ff30788b68 is not stack'd, malloc'd or (recently) free'd

Fixes: 4028a9482f9399e3c3587f5c6eca6c0b128c9afc
("seat: use focus_change event to update focused/active view")
src/xwayland-unmanaged.c
src/xwayland.c