[gs-commits] mupdf 1.16.1.44 Squash signed/unsigned warning.

[email protected] (Robin Watts) Fri, 27 Sep 2019 13:25:28 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
commit d2b9951cea916a6231f76e32421c380f0ec64777
Author: Robin Watts <[email protected]>
Date:   Wed Sep 25 19:54:23 2019 +0100

    Squash signed/unsigned warning.

diff --git a/source/fitz/bitmap.c b/source/fitz/bitmap.c
index 6cfe920..8cff296 100644
--- a/source/fitz/bitmap.c
+++ b/source/fitz/bitmap.c
@@ -282,7 +282,7 @@ fz_new_bitmap(fz_context *ctx, int w, int h, int n, int xres, int yres)
 
 	/* Stride is 32 bit aligned. We may want to make this 64 bit if we use SSE2 etc. */
 	int stride = ((n * w + 31) & ~31) >> 3;
-	if (h > SIZE_MAX / stride)
+	if (h < 0 || ((size_t)h > (size_t)(SIZE_MAX / stride)))
 		fz_throw(ctx, FZ_ERROR_MEMORY, "bitmap too large");
 
 	bit = fz_malloc_struct(ctx, fz_bitmap);

http://git.ghostscript.com/?p=mupdf.git;a=commit;h=d2b9951cea916a6231f76e32421c380f0ec64777

--
MuPDF library
Artifex Software, Inc.