From 0b48e6b5ca04e4ed75f90fca0dcd2b26814a7695 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Thu, 11 Feb 2021 23:20:34 +0100 Subject: [PATCH] =?UTF-8?q?backend-wayland:=20Abort=20early=20when=20wl=5F?= =?UTF-8?q?shm=20isn=E2=80=99t=20advertised?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This prevents a segfault in libwayland-cursor when the parent compositor doesn’t have any of the needed protocols implemented. Signed-off-by: Emmanuel Gil Peyrot --- libweston/backend-wayland/wayland.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libweston/backend-wayland/wayland.c b/libweston/backend-wayland/wayland.c index 60d42bf3..bb98e9c8 100644 --- a/libweston/backend-wayland/wayland.c +++ b/libweston/backend-wayland/wayland.c @@ -2760,6 +2760,11 @@ wayland_backend_create(struct weston_compositor *compositor, wl_registry_add_listener(b->parent.registry, ®istry_listener, b); wl_display_roundtrip(b->parent.wl_display); + if (b->parent.shm == NULL) { + weston_log("Error: Failed to retrieve wl_shm from parent Wayland compositor\n"); + goto err_display; + } + create_cursor(b, new_config); #ifdef ENABLE_EGL