diff options
-rw-r--r-- | source/fitz/load-png.c | 7 | ||||
-rw-r--r-- | source/xps/xps-zip.c | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/source/fitz/load-png.c b/source/fitz/load-png.c index ad22e128..984dbed2 100644 --- a/source/fitz/load-png.c +++ b/source/fitz/load-png.c @@ -452,6 +452,13 @@ png_read_image(fz_context *ctx, struct info *info, unsigned char *p, unsigned in p += size + 12; total -= size + 12; } + if (stm.avail_out != 0) + { + memset(stm.next_out, 0xff, stm.avail_out); + fz_warn(ctx, "missing pixel data in png image; possibly truncated"); + } + else if (total <= 8) + fz_warn(ctx, "missing IEND chunk in png image; possibly truncated"); } fz_catch(ctx) { diff --git a/source/xps/xps-zip.c b/source/xps/xps-zip.c index f70a28bf..da1450e3 100644 --- a/source/xps/xps-zip.c +++ b/source/xps/xps-zip.c @@ -169,6 +169,12 @@ xps_read_zip_entry(xps_document *doc, xps_entry *ent, unsigned char *outbuf) } fz_free(ctx, inbuf); + + if (stream.avail_out > 0) + { + fz_warn(ctx, "Truncated zipfile entry found, possibly corrupt data"); + memset(stream.next_out, 0, stream.avail_out); + } } else { |