]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Fix divide by zero if pitch is zero. (single line blit)
authorToni Wilen <twilen@winuae.net>
Sun, 8 Apr 2018 10:41:32 +0000 (13:41 +0300)
committerToni Wilen <twilen@winuae.net>
Sun, 8 Apr 2018 10:41:32 +0000 (13:41 +0300)
qemuvga/cirrus_vga.cpp

index 9502dca9d4c9db02f7470ef06509757b1bd0dd78..9e6f53fcf7f117f452e26ae5afaf8285b962d28c 100644 (file)
@@ -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;