From f328890ed13aff675252511fad143bbd692f66b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 10 Feb 2015 20:58:09 +0800 Subject: [PATCH] wayland: Fail when popup parent does not have an allowed role An xdg_popup may only have another xdg_popup or xdg_surface as a parent, so send an error if it provides an invalid parent. https://bugzilla.gnome.org/show_bug.cgi?id=744452 --- src/wayland/meta-wayland-surface.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index e5960bd7b..5904eac55 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -1069,6 +1069,14 @@ xdg_shell_get_xdg_popup (struct wl_client *client, XDG_SHELL_ERROR_ROLE) != 0) return; + if (parent_surf->xdg_popup == NULL && parent_surf->xdg_surface == NULL) + { + wl_resource_post_error (resource, + XDG_POPUP_ERROR_INVALID_PARENT, + "invalid parent surface"); + return; + } + surface->xdg_popup = wl_resource_create (client, &xdg_popup_interface, wl_resource_get_version (resource), id); wl_resource_set_implementation (surface->xdg_popup, &meta_wayland_xdg_popup_interface, surface, xdg_popup_destructor);