diff options
author | nanahi <130121847+na-na-hi@users.noreply.github.com> | 2024-01-17 10:20:20 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2024-01-19 23:55:52 +0000 |
commit | 146bef059a716937bc588bad03995427abcd2c05 (patch) | |
tree | fe59e858f4e9769b63344982d685d264476a1af2 /video/out/wayland_common.c | |
parent | 92d1e9cd8a919b1961de9d9871256bbc76997ede (diff) | |
download | mpv-146bef059a716937bc588bad03995427abcd2c05.tar.bz2 mpv-146bef059a716937bc588bad03995427abcd2c05.tar.xz |
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.
Diffstat (limited to 'video/out/wayland_common.c')
-rw-r--r-- | video/out/wayland_common.c | 5 |
1 files changed, 5 insertions, 0 deletions
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; |