]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Check both input and output size.
authorToni Wilen <twilen@winuae.net>
Sat, 7 Jun 2025 14:24:54 +0000 (17:24 +0300)
committerToni Wilen <twilen@winuae.net>
Sat, 7 Jun 2025 14:24:54 +0000 (17:24 +0300)
drawing.cpp

index 335b2bc657030e7bfa65ff8b4c80293acb6fd1e2..e90ce7ae1ec19ac8f0a35347a62046b8364c463e 100644 (file)
@@ -1903,8 +1903,8 @@ static void setspecialmonitorpos(struct vidbuffer *vb)
 static void vbcopy(struct vidbuffer *vbout, struct vidbuffer *vbin)
 {
        if (vbout->locked) {
-               for (int h = 0; h < vbout->height_allocated; h++) {
-                       memcpy(vbout->bufmem + h * vbout->rowbytes, vbin->bufmem + h * vbin->rowbytes, vbout->width_allocated * vbout->pixbytes);
+               for (int h = 0; h < vbout->height_allocated && h < vbin->height_allocated; h++) {
+                       memcpy(vbout->bufmem + h * vbout->rowbytes, vbin->bufmem + h * vbin->rowbytes, (vbin->width_allocated > vbout->width_allocated ? vbout->width_allocated : vbin->width_allocated) * vbout->pixbytes);
                }
        }
 }