source/fitz/output-pdfocr.c: added assert for no division-by-zero.
authorJulian Smith <[email protected]>
Sat, 15 Oct 2022 10:09:06 +0000 (11:09 +0100)
committerJulian Smith <[email protected]>
Mon, 17 Oct 2022 12:08:51 +0000 (13:08 +0100)
source/fitz/output-pdfocr.c

index 6afb4c804d65148c9bc0daf676df938b9c67cd87..eb4999a260b628c7d0f98eedf06d358c95e3b614 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "mupdf/fitz.h"
 
+#include <assert.h>
 #include <string.h>
 #include <limits.h>
 
@@ -272,6 +273,7 @@ pdfocr_write_header(fz_context *ctx, fz_band_writer *writer_, fz_colorspace *cs)
 
        if (sh == 0)
                sh = h;
+       assert(sh != 0 && "pdfocr_write_header() should not be given zero height input.");
        strips = (h + sh-1)/sh;
 
        if (a != 0)