[Spice-devel] [PATCH xf86-qxl 2/2] Check qxl_download_box() arguments

Marc-André Lureau marcandre.lureau at gmail.com
Sun Oct 12 05:24:59 PDT 2014


From: Marc-Andre Lureau <marcandre.lureau at redhat.com>

Assert on valid arguments, and return early if the given region is empty.

Fixes:
http://bugzilla.redhat.com/1151559
---
 src/qxl_surface.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/qxl_surface.c b/src/qxl_surface.c
index 1075eae..242083e 100644
--- a/src/qxl_surface.c
+++ b/src/qxl_surface.c
@@ -140,6 +140,11 @@ download_box_no_update (qxl_surface_t *surface, int x1, int y1, int x2, int y2)
 void
 qxl_download_box (qxl_surface_t *surface, int x1, int y1, int x2, int y2)
 {
+    assert (x2 >= x1 && y2 >= y1);
+
+    if (x1 == x2 || y1 == y2)
+        return;
+
     surface->qxl->bo_funcs->update_area(surface, x1, y1, x2, y2);
 
     download_box_no_update(surface, x1, y1, x2, y2);
-- 
1.9.3



More information about the Spice-devel mailing list