From: Toni Wilen Date: Sun, 8 Apr 2018 10:41:32 +0000 (+0300) Subject: Fix divide by zero if pitch is zero. (single line blit) X-Git-Tag: 4000~133 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=71db96ccc79b4e7ae62fcbdfbc8a35b06c32784d;p=francis%2Fwinuae.git Fix divide by zero if pitch is zero. (single line blit) --- diff --git a/qemuvga/cirrus_vga.cpp b/qemuvga/cirrus_vga.cpp index 9502dca9..9e6f53fc 100644 --- a/qemuvga/cirrus_vga.cpp +++ b/qemuvga/cirrus_vga.cpp @@ -188,9 +188,15 @@ static void check_blit(int32_t addr, uint32_t mask, int pitch, int width, int *h off -= width * (depth / 8); } if (off > mask + 1) { - h -= (off - (mask + 1) + pitch - 1) / pitch; + if (pitch) + h -= (off - (mask + 1) + pitch - 1) / pitch; + else + h = 0; } else if (off < 0) { - h -= ((-off) + pitch - 1) / pitch; + if (pitch) + h -= ((-off) + pitch - 1) / pitch; + else + h = 0; } if (h < 0) h = 0;