[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] Prevent SEGV in VNC server for old clients
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH] Prevent SEGV in VNC server for old clients |
Date: |
Sat, 17 May 2008 21:34:12 -0500 |
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>
diff --git a/vnc.c b/vnc.c
index 842124b..4b57838 100644
--- a/vnc.c
+++ b/vnc.c
@@ -265,6 +265,11 @@ static void vnc_dpy_update(DisplayState *ds, int x, int y,
int w, int h)
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);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH] Prevent SEGV in VNC server for old clients,
Anthony Liguori <=