]> git.proxmox.com Git - mirror_qemu.git/commitdiff
Fix vnc memory corruption with width = 1400
authorGerd Hoffmann <kraxel@redhat.com>
Mon, 14 Jun 2010 10:28:23 +0000 (12:28 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 10 Feb 2012 08:58:33 +0000 (09:58 +0100)
vnc assumes that the screen width is a multiple of 16 in several places.
If this is not the case vnc will overrun buffers, corrupt memory, make
qemu crash.

This is the minimum fix for this bug. It makes sure we don't overrun the
scanline, thereby fixing the segfault.  The rendering is *not* correct
though, there is a black border at the right side of the screen, 8
pixels wide because 1400 % 16 == 8.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
ui/vnc.c

index 16b79ec423b89c467a714eda3b085455d2ff0c59..5752bf87405ea286bd0f02d63b95d3dfdcd2bda2 100644 (file)
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2445,7 +2445,7 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
             guest_ptr  = guest_row;
             server_ptr = server_row;
 
-            for (x = 0; x < vd->guest.ds->width;
+            for (x = 0; x + 15 < vd->guest.ds->width;
                     x += 16, guest_ptr += cmp_bytes, server_ptr += cmp_bytes) {
                 if (!test_and_clear_bit((x / 16), vd->guest.dirty[y]))
                     continue;