From b80337a8f2bb5d032f533ed5e0feb6292670528f Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 22 Jan 2024 17:19:50 +0100 Subject: xdg-shell: assert that configure events carry positive or zero sizes Negative values here would indicate a compositor bug. For xdg_popup, zero values are not allowed. --- types/xdg_shell/wlr_xdg_popup.c | 1 + types/xdg_shell/wlr_xdg_toplevel.c | 1 + 2 files changed, 2 insertions(+) diff --git a/types/xdg_shell/wlr_xdg_popup.c b/types/xdg_shell/wlr_xdg_popup.c index e376344b..27627984 100644 --- a/types/xdg_shell/wlr_xdg_popup.c +++ b/types/xdg_shell/wlr_xdg_popup.c @@ -28,6 +28,7 @@ struct wlr_xdg_popup_configure *send_xdg_popup_configure( } struct wlr_box *geometry = &configure->geometry; + assert(geometry->width > 0 && geometry->height > 0); xdg_popup_send_configure(popup->resource, geometry->x, geometry->y, geometry->width, geometry->height); diff --git a/types/xdg_shell/wlr_xdg_toplevel.c b/types/xdg_shell/wlr_xdg_toplevel.c index 314611f0..b27567fe 100644 --- a/types/xdg_shell/wlr_xdg_toplevel.c +++ b/types/xdg_shell/wlr_xdg_toplevel.c @@ -556,6 +556,7 @@ void wlr_xdg_toplevel_send_close(struct wlr_xdg_toplevel *toplevel) { uint32_t wlr_xdg_toplevel_set_size(struct wlr_xdg_toplevel *toplevel, int32_t width, int32_t height) { + assert(width >= 0 && height >= 0); toplevel->scheduled.width = width; toplevel->scheduled.height = height; return wlr_xdg_surface_schedule_configure(toplevel->base); -- cgit v1.2.3