From: Toni Wilen Date: Sat, 7 Jun 2025 14:24:54 +0000 (+0300) Subject: Check both input and output size. X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=4618f2ca478230138e585692b9a60b1838b84981;p=francis%2Fwinuae.git Check both input and output size. --- diff --git a/drawing.cpp b/drawing.cpp index 335b2bc6..e90ce7ae 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -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); } } }