aboutsummaryrefslogtreecommitdiff
path: root/vnc.c
diff options
context:
space:
mode:
Diffstat (limited to 'vnc.c')
-rw-r--r--vnc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/vnc.c b/vnc.c
index 842124b056..4b578388c7 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);