From c533a06e93e5eb70aae70900ded384646c4861c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 15 Nov 2017 16:03:36 +0800 Subject: [PATCH] wayland/xdg-shell: Check popup parent type when assigning We only allow mapping popups on top of surfaces with a xdg_surface based role. Add a check and fail clients that doesn't follow this rule. https://bugzilla.gnome.org/show_bug.cgi?id=790358 --- src/wayland/meta-wayland-xdg-shell.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c index 5ca39b318..8bb2ec787 100644 --- a/src/wayland/meta-wayland-xdg-shell.c +++ b/src/wayland/meta-wayland-xdg-shell.c @@ -1553,6 +1553,14 @@ xdg_surface_constructor_get_popup (struct wl_client *client, return; } + if (!META_IS_WAYLAND_XDG_SURFACE (parent_surface->role)) + { + wl_resource_post_error (xdg_shell_resource, + ZXDG_SHELL_V6_ERROR_INVALID_POPUP_PARENT, + "Invalid popup parent role"); + return; + } + xdg_popup = META_WAYLAND_XDG_POPUP (surface->role); xdg_popup->resource = wl_resource_create (client, &zxdg_popup_v6_interface,