[gs-commits] mupdf 1.16.1.57 jbig2: Avoid signedness issues when refer

[email protected] (Sebastian Rasmussen) Tue, 1 Oct 2019 14:55:50 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
commit 9ce9b1a28f56f7d761559c54253d6e8dd9c1e7d6
Author: Sebastian Rasmussen <[email protected]>
Date:   Fri Sep 27 17:46:07 2019 +0200

    jbig2: Avoid signedness issues when referring to subimages.

diff --git a/source/fitz/load-jbig2.c b/source/fitz/load-jbig2.c
index dd17ae8..0b28599 100644
--- a/source/fitz/load-jbig2.c
+++ b/source/fitz/load-jbig2.c
@@ -10,8 +10,8 @@ struct info
 	fz_context *ctx;
 	unsigned long width, height;
 	unsigned long xres, yres;
-	unsigned long  stride;
-	unsigned long  pages;
+	unsigned long stride;
+	unsigned long pages;
 	fz_colorspace *cspace;
 	JB2_Handle_Document doc;
 
@@ -130,7 +130,7 @@ jbig2_read_image(fz_context *ctx, struct info *jbig2, const unsigned char *buf,
 			fz_throw(ctx, FZ_ERROR_GENERIC, "cannot get number of pages: %d", (int) err);
 		if (subimage != -1)
 		{
-			if (subimage < 0 || subimage >= state->pages)
+			if (subimage < 0 || (unsigned long) subimage >= state->pages)
 				fz_throw(ctx, FZ_ERROR_GENERIC, "page number out of bounds %d vs %ld", subimage, state->pages);
 			err = JB2_Document_Set_Page(state->doc, subimage);
 			if (err != cJB2_Error_OK)

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

--
MuPDF library
Artifex Software, Inc.