Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LyShZ-0006u4-Mb for qemu-devel@nongnu.org; Mon, 27 Apr 2009 11:25:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LyShU-0006si-A1 for qemu-devel@nongnu.org; Mon, 27 Apr 2009 11:25:00 -0400 Received: from [199.232.76.173] (port=54838 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LyShU-0006sR-1Q for qemu-devel@nongnu.org; Mon, 27 Apr 2009 11:24:56 -0400 Received: from mx2.redhat.com ([66.187.237.31]:38420) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LyShT-00050x-Je for qemu-devel@nongnu.org; Mon, 27 Apr 2009 11:24:55 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n3RFOsG2002393 for ; Mon, 27 Apr 2009 11:24:54 -0400 From: Gerd Hoffmann Date: Mon, 27 Apr 2009 17:24:51 +0200 Message-Id: <1240845891-18340-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH] vnc: fix segfault List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Move down cmp_bytes initialization. Must be after vga_hw_update() call, because that one might change the screen depth. Signed-off-by: Gerd Hoffmann --- vnc.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/vnc.c b/vnc.c index 8e8acc2..c3d805e 100644 --- a/vnc.c +++ b/vnc.c @@ -701,7 +701,7 @@ static void vnc_update_client(void *opaque) int y; uint8_t *guest_row; uint8_t *server_row; - int cmp_bytes = 16 * ds_get_bytes_per_pixel(vs->ds); + int cmp_bytes; uint32_t width_mask[VNC_DIRTY_WORDS]; int n_rectangles; int saved_offset; @@ -721,6 +721,7 @@ static void vnc_update_client(void *opaque) * Update server dirty map. */ vnc_set_bits(width_mask, (ds_get_width(vs->ds) / 16), VNC_DIRTY_WORDS); + cmp_bytes = 16 * ds_get_bytes_per_pixel(vs->ds); guest_row = vs->guest.ds->data; server_row = vs->server.ds->data; for (y = 0; y < vs->guest.ds->height; y++) { -- 1.6.2.2