Bug 275625 - [WPE] WPE Platform: Do not assume that Wayland seats are bound before text input manager
Summary: [WPE] WPE Platform: Do not assume that Wayland seats are bound before text in...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WPE WebKit (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Adrian Perez
URL:
Keywords:
Depends on:
Blocks: WPEPlatformAPI
  Show dependency treegraph
 
Reported: 2024-06-18 11:22 PDT by Adrian Perez
Modified: 2024-06-18 23:25 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Perez 2024-06-18 11:22:00 PDT
The Wayland registry listener in WPEDisplayWayland.cpp assumes a particular
order in which the compositor will advertise the available global interfaces,
and this bit:

    } else if (!std::strcmp(interface, "zwp_text_input_manager_v3")) {
        priv->textInputManagerV3 = static_cast<struct zwp_text_input_manager_v3*>(wl_registry_bind(registry, name, &zwp_text_input_manager_v3_interface, 1));
        priv->textInputV3 = zwp_text_input_manager_v3_get_text_input(priv->textInputManagerV3, priv->wlSeat->seat());
    }

...assumes that priv->wlSeat will be valid at the point when the input manager
interface is advertised. But alas, there is no defined order in the Wayland
protocol, and only the wl_registry global is guaranteed to be the first thing
coming down the wire (for bootstrapping).

Currently on my system using the labwc compositor (which is based on wlroots)
the input manager interface is announced *before* the seat, resulting in a
NULL pointer dereference with its corresponding SIGSEGV and crash.
Comment 1 Adrian Perez 2024-06-18 15:31:01 PDT
Pull request: https://github.com/WebKit/WebKit/pull/29951
Comment 2 EWS 2024-06-18 23:25:36 PDT
Committed 280164@main (73db3cb76418): <https://commits.webkit.org/280164@main>

Reviewed commits have been landed. Closing PR #29951 and removing active labels.