[Spice-devel] [PATCH] server/red_worker: handle_dev_update_area: fail if invalid area

Alon Levy alevy at redhat.com
Sun Jul 29 02:54:31 PDT 2012


---
 server/red_worker.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/server/red_worker.c b/server/red_worker.c
index 9009462..eb21208 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -4589,6 +4589,12 @@ static void red_update_area(RedWorker *worker, const SpiceRect *area, int surfac
 #endif
     spice_debug("surface %d: area ==>", surface_id);
     rect_debug(area);
+
+    spice_return_if_fail(surface_id >= 0 && surface_id < NUM_SURFACES);
+    spice_return_if_fail(area);
+    spice_return_if_fail(area->left >= 0 && area->top >= 0 &&
+                         area->left < area->right && area->top < area->bottom);
+
     surface = &worker->surfaces[surface_id];
 
     last = NULL;
-- 
1.7.11.2



More information about the Spice-devel mailing list