From 146bef059a716937bc588bad03995427abcd2c05 Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Wed, 17 Jan 2024 10:20:20 -0500 Subject: wayland_common: guard against negative configure sizes Negative values are nonsense to mpv, and can cause protocol error afterwards, like xdg_surface::set_window_geometry which doesn't accept negative values. Treat any negative values as zero (client determines size) for now. --- video/out/wayland_common.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'video/out/wayland_common.c') diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index a19f9c1c03..cf4fb8a574 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -890,6 +890,11 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel, struct mp_vo_opts *vo_opts = wl->vo_opts; struct mp_rect old_geometry = wl->geometry; + if (width < 0 || height < 0) { + MP_WARN(wl, "Compositor sent negative width/height values. Treating them as zero.\n"); + width = height = 0; + } + int old_toplevel_width = wl->toplevel_width; int old_toplevel_height = wl->toplevel_height; wl->toplevel_width = width; -- cgit v1.2.3