qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [4502] Prevent SEGV in VNC server for old clients (Anthony


From: Andrzej Zaborowski
Subject: [Qemu-devel] [4502] Prevent SEGV in VNC server for old clients (Anthony Liguori).
Date: Tue, 20 May 2008 00:07:59 +0000

Revision: 4502
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4502
Author:   balrog
Date:     2008-05-20 00:07:58 +0000 (Tue, 20 May 2008)

Log Message:
-----------
Prevent SEGV in VNC server for old clients (Anthony Liguori).

If the client does not support the DesktopResize pseudo-encoding, then
vs->{width,height} may be smaller than ds->{width,height}.  dirty_row is
sized according to vs->{width,height}, not ds->{width,height}.

This patch makes sure to bound the update region to vs->{width,height} to
avoid a possible SEGV.

Signed-off-by: Anthony Liguori <address@hidden>
Reported-by: Marcelo Tosatti <address@hidden>

Modified Paths:
--------------
    trunk/vnc.c

Modified: trunk/vnc.c
===================================================================
--- trunk/vnc.c 2008-05-20 00:01:55 UTC (rev 4501)
+++ trunk/vnc.c 2008-05-20 00:07:58 UTC (rev 4502)
@@ -265,6 +265,11 @@
     w += (x % 16);
     x -= (x % 16);
 
+    x = MIN(x, vs->width);
+    y = MIN(y, vs->height);
+    w = MIN(x + w, vs->width) - x;
+    h = MIN(y + h, vs->height) - y;
+
     for (; y < h; y++)
        for (i = 0; i < w; i += 16)
            vnc_set_bit(vs->dirty_row[y], (x + i) / 16);






reply via email to

[Prev in Thread] Current Thread [Next in Thread]