[gs-commits] mupdf 1.16.1.62 Avoid signedness issues for pointer compa
[email protected] (Sebastian Rasmussen) Tue, 1 Oct 2019 14:55:51 +0000 (UTC)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 006110bb4cd9b97cb6d96022a78b34b8acfbba43 Author: Sebastian Rasmussen <[email protected]> Date: Fri Sep 27 17:56:22 2019 +0200 Avoid signedness issues for pointer comparisons. diff --git a/source/fitz/load-tiff.c b/source/fitz/load-tiff.c index 9376c22..b13f389 100644 --- a/source/fitz/load-tiff.c +++ b/source/fitz/load-tiff.c @@ -882,7 +882,7 @@ tiff_read_tag(fz_context *ctx, struct tiff *tiff, unsigned offset) case JPEGTables: /* Check both value and value + count to allow for overflow */ - if (value > tiff->ep - tiff->bp || value + count > tiff->ep - tiff->bp) + if (value > (size_t)(tiff->ep - tiff->bp) || value + count > (size_t)(tiff->ep - tiff->bp)) fz_throw(ctx, FZ_ERROR_GENERIC, "TIFF JPEG tables out of range"); tiff->jpegtables = tiff->bp + value; tiff->jpegtableslen = count; diff --git a/source/fitz/output.c b/source/fitz/output.c index acfc0e4..0d09e2a 100644 --- a/source/fitz/output.c +++ b/source/fitz/output.c @@ -403,7 +403,7 @@ fz_write_data(fz_context *ctx, fz_output *out, const void *data_, size_t size) if (out->bp) { - if (size >= out->ep - out->bp) /* too large for buffer */ + if (size >= (size_t) (out->ep - out->bp)) /* too large for buffer */ { if (out->wp > out->bp) { diff --git a/source/fitz/string.c b/source/fitz/string.c index 488cbbb..c1c30e2 100644 --- a/source/fitz/string.c +++ b/source/fitz/string.c @@ -22,7 +22,7 @@ size_t fz_strnlen(const char *s, size_t n) { const char *p = memchr(s, 0, n); - return p ? p - s : n; + return p ? (size_t) (p - s) : n; } int @@ -735,7 +735,7 @@ static char *twoway_memmem(const unsigned char *h, const unsigned char *z, const /* Search loop */ for (;;) { /* If remainder of haystack is shorter than needle, done */ - if (z-h < l) return 0; + if ((size_t)(z-h) < l) return 0; /* Check last byte first; advance by shift on mismatch */ if (BITOP(byteset, h[l-1], &)) { diff --git a/source/html/epub-doc.c b/source/html/epub-doc.c index 44fb3fc..423ca02 100644 --- a/source/html/epub-doc.c +++ b/source/html/epub-doc.c @@ -50,7 +50,7 @@ epub_resolve_link(fz_context *ctx, fz_document *doc_, const char *dest, float *x epub_chapter *ch; const char *s = strchr(dest, '#'); - size_t n = s ? s - dest : strlen(dest); + size_t n = s ? (size_t)(s - dest) : strlen(dest); if (s && s[1] == 0) s = NULL; http://git.ghostscript.com/?p=mupdf.git;a=commit;h=006110bb4cd9b97cb6d96022a78b34b8acfbba43 -- MuPDF library Artifex Software, Inc.