[Spice-devel,01/14] server/red_worker: red_draw_qxl_drawable: protect from NULL dereference in case of buggy driver (or recording)

Submitted by Frediano Ziglio on Oct. 23, 2015, 12:13 p.m.

Details

Message ID 1445602418-3910-2-git-send-email-fziglio@redhat.com
State Superseded
Headers show
Series "Backported some patches from refactory branches (23th Oct)" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio Oct. 23, 2015, 12:13 p.m.
From: Alon Levy <alon@pobox.com>

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

Patch hide | download patch | download mbox

diff --git a/server/red_worker.c b/server/red_worker.c
index 96d899d..65961db 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -4206,6 +4206,11 @@  static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
 
     image_cache_aging(&worker->image_cache);
 
+    if (!canvas) {
+        spice_warning("ignoring drawable to destroyed surface %d\n", drawable->surface_id);
+        return;
+    }
+
     region_add(&surface->draw_dirty_region, &drawable->red_drawable->bbox);
 
     switch (drawable->red_drawable->type) {