summaryrefslogtreecommitdiff
path: root/desktop-shell
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2015-10-07 14:44:50 +0800
committerDerek Foreman <derekf@osg.samsung.com>2015-10-07 11:43:59 -0500
commitbc5d849c9d2088b22744d40840b5663c2ea4f385 (patch)
treebd069d7122863498d012c0bf8eff183b16843b5f /desktop-shell
parent3f607d3e1c66e7f9e6d45f324c95638039e7c71b (diff)
downloadweston-bc5d849c9d2088b22744d40840b5663c2ea4f385.tar.gz
desktop-shell: NULL check whether a popup parent is a shell surface
get_shell_surface(parent) may return NULL if the client passed a unassigned wl_surface or a wl_surface with a non-shell surface role (such as cursor role). https://bugs.freedesktop.org/show_bug.cgi?id=92316 Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Tested-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Diffstat (limited to 'desktop-shell')
-rw-r--r--desktop-shell/shell.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 09ce5e18..7f007668 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -4279,8 +4279,9 @@ xdg_get_xdg_popup(struct wl_client *client,
* top level or not. */
parent_shsurf = get_shell_surface(parent);
- if (!shell_surface_is_xdg_popup(parent_shsurf) &&
- !shell_surface_is_xdg_surface(parent_shsurf)) {
+ if (!parent_shsurf ||
+ (!shell_surface_is_xdg_popup(parent_shsurf) &&
+ !shell_surface_is_xdg_surface(parent_shsurf))) {
wl_resource_post_error(resource,
XDG_SHELL_ERROR_INVALID_POPUP_PARENT,
"xdg_popup parent was invalid");