From 56ab3e9b10fdaaf41eef6e47f81ffe54fd9d5a77 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Thu, 15 Feb 2018 08:07:57 +0100 Subject: xdg_shell stable: fix zero-sized positioner anchor_rect We used 0 as unset-check value before, which was fine when 0-width was invalid, but isn't anymore --- types/wlr_xdg_shell.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/wlr_xdg_shell.c b/types/wlr_xdg_shell.c index 914ee322..53ff25d0 100644 --- a/types/wlr_xdg_shell.c +++ b/types/wlr_xdg_shell.c @@ -334,6 +334,10 @@ static void xdg_shell_create_positioner(struct wl_client *wl_client, return; } + /* set widths to detect improper usages of get_popup */ + positioner->size.width = -1; + positioner->anchor_rect.width = -1; + positioner->resource = wl_resource_create(wl_client, &xdg_positioner_interface, wl_resource_get_version(resource), @@ -500,7 +504,7 @@ static void xdg_surface_get_popup(struct wl_client *client, struct wlr_xdg_positioner *positioner = wl_resource_get_user_data(positioner_resource); - if (positioner->size.width == 0 || positioner->anchor_rect.width == 0) { + if (positioner->size.width == -1 || positioner->anchor_rect.width == -1) { wl_resource_post_error(resource, XDG_WM_BASE_ERROR_INVALID_POSITIONER, "positioner object is not complete"); -- cgit v1.2.3