Commit 5ab4518ce8 for qemu.org
commit 5ab4518ce805bbf9fc68f7f4709457485e7cfaca
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date: Sun Oct 4 14:23:32 2026 +0400
ui/vnc-jobs: assert rect coordinates and dimensions in vnc_job_add_rect
All callers guarantee non-negative coordinates and positive
dimensions. Add an assert to document the invariant that
vnc_worker_clamp_rect relies on.
Reported-by: Hui Peng <benquike@gmail.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20261004-issue-4560-v1-18-ccbef537cbeb@redhat.com>
diff --git a/ui/vnc-jobs.c b/ui/vnc-jobs.c
index 90b68bf4cb..81c4fa5dbd 100644
--- a/ui/vnc-jobs.c
+++ b/ui/vnc-jobs.c
@@ -87,6 +87,7 @@ int vnc_job_add_rect(VncJob *job, int x, int y, int w, int h)
trace_vnc_job_add_rect(job->vs, job, x, y, w, h);
assert(!QTAILQ_IN_USE(job, next));
+ assert(x >= 0 && y >= 0 && w > 0 && h > 0);
entry->rect.x = x;
entry->rect.y = y;