Subject: [PATCH 1/4] vnc: Fix fatal crash with vnc reverse mode

From: Gerd Hoffmann <[email-masked]>
Date: Fri, 17 Feb 2012 10:10:55 +0100

RH-Author: Gerd Hoffmann <[email-masked]>
Message-id: <[email-masked]>
Patchwork-id: 37407
O-Subject: [RHEL-6.3 qemu-kvm PATCH] vnc: Fix fatal crash with vnc reverse mode
Bugzilla: 769142
RH-Acked-by: Markus Armbruster <[email-masked]>
RH-Acked-by: Luiz Capitulino <[email-masked]>
RH-Acked-by: Laszlo Ersek <[email-masked]>

From: Stefan Weil <[email-masked]>

Reverse mode is unusable:

	qemu -vnc localhost:5500,reverse

crashes in vnc_refresh_server_surface because some pointers are NULL.

Fix this by calling vnc_dpy_resize (which initializes these pointers)
before calling vnc_refresh.

Cc: Anthony Liguori <[email-masked]>
Signed-off-by: Stefan Weil <[email-masked]>
Signed-off-by: Anthony Liguori <[email-masked]>
(cherry picked from commit 5db8378a7710df7899544004967597eb395418c2)

bugzilla: #769142 - Qemu-kvm core dumped when connecting to listening
                    vnc with "reverse"
brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=4053337
---
 vnc.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Signed-off-by: Michal Novotny <[email-masked]>
---
 vnc.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/vnc.c b/vnc.c
index edcc448..e4ad937 100644
--- a/vnc.c
+++ b/vnc.c
@@ -2389,6 +2389,7 @@ static void vnc_init_timer(VncDisplay *vd)
     vd->timer_interval = VNC_REFRESH_INTERVAL_BASE;
     if (vd->timer == NULL && vd->clients != NULL) {
         vd->timer = qemu_new_timer(rt_clock, vnc_refresh, vd);
+        vnc_dpy_resize(vd->ds);
         vnc_refresh(vd);
     }
 }
-- 
1.7.7.6