From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1tLE-0004FV-JT for qemu-devel@nongnu.org; Thu, 26 Nov 2015 04:59:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1tL9-0006t2-TJ for qemu-devel@nongnu.org; Thu, 26 Nov 2015 04:59:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42197) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1tL9-0006sx-Ni for qemu-devel@nongnu.org; Thu, 26 Nov 2015 04:59:47 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 4DCA18F28A for ; Thu, 26 Nov 2015 09:59:47 +0000 (UTC) From: Gerd Hoffmann Date: Thu, 26 Nov 2015 10:59:39 +0100 Message-Id: <1448531979-9773-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1448531979-9773-1-git-send-email-kraxel@redhat.com> References: <1448531979-9773-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PULL 1/1] vnc: fix segfault List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann 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 Tested-by: Anthony PERARD Signed-off-by: Gerd Hoffmann --- ui/vnc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/vnc.c b/ui/vnc.c index c9f2fed..7538405 100644 --- 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)) { -- 1.8.3.1