summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--hw/display/artist.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/hw/display/artist.c b/hw/display/artist.c
index a959b2c158..71982559c6 100644
--- a/hw/display/artist.c
+++ b/hw/display/artist.c
@@ -206,7 +206,12 @@ static void artist_invalidate_lines(struct vram_buffer *buf,
                                     int starty, int height)
 {
     int start = starty * buf->width;
-    int size = height * buf->width;
+    int size;
+
+    if (starty + height > buf->height)
+        height = buf->height - starty;
+
+    size = height * buf->width;
 
     if (start + size <= buf->size) {
         memory_region_set_dirty(&buf->mr, start, size);