]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
vnc: fix segfault
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 25 Nov 2015 07:04:05 +0000 (08:04 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Thu, 26 Nov 2015 07:32:11 +0000 (08:32 +0100)
Commit "c7628bf vnc: only alloc server surface with clients connected"
missed one rarely used codepath (cirrus with guest drivers using 2d
accel) where we have to check for the server surface being present,
to avoid qemu crashing with a NULL pointer dereference.  Add the check.

Reported-by: Anthony PERARD <anthony.perard@citrix.com>
Tested-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
ui/vnc.c

index c9f2fed9c97cd430516e9ddc1139c208d894ace5..75384053999712368d36ccfd7d43d742c6f05370 100644 (file)
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -931,6 +931,11 @@ static void vnc_dpy_copy(DisplayChangeListener *dcl,
     int i, x, y, pitch, inc, w_lim, s;
     int cmp_bytes;
 
+    if (!vd->server) {
+        /* no client connected */
+        return;
+    }
+
     vnc_refresh_server_surface(vd);
     QTAILQ_FOREACH_SAFE(vs, &vd->clients, next, vn) {
         if (vnc_has_feature(vs, VNC_FEATURE_COPYRECT)) {