After clamping coordinates to the surface dimensions, the resulting
width or height can be zero. Proceeding with such values would pass
degenerate rectangles to display listeners. Return early to avoid
useless work.

Fixes: 7c20b4a374d0 ("console: fix displaychangelisteners interface")
Reported-by: Pavee Hui <[email protected]>
Signed-off-by: Marc-André Lureau <[email protected]>
---
 ui/console.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui/console.c b/ui/console.c
index 14f148118e37..795c9857de82 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -740,6 +740,9 @@ void qemu_console_update(QemuConsole *con, int x, int y, 
int w, int h)
     y = MIN(y, height);
     w = MIN(w, width - x);
     h = MIN(h, height - y);
+    if (w <= 0 || h <= 0) {
+        return;
+    }
 
     dpy_gfx_update_texture(con, con->surface, x, y, w, h);
     QLIST_FOREACH(dcl, &s->listeners, next) {

-- 
2.56.0.rc0.29.g47ce80527c56


Reply via email to