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: Pavee Hui <[email protected]> Signed-off-by: Marc-André Lureau <[email protected]> --- ui/vnc-jobs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/vnc-jobs.c b/ui/vnc-jobs.c index 90b68bf4cb98..81c4fa5dbdbb 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; -- 2.56.0.rc0.29.g47ce80527c56
