diff options
author | Simon Bünzli <zeniko@gmail.com> | 2013-09-25 15:31:24 +0200 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-09-27 17:09:45 +0100 |
commit | a4b58d62b59d95152ebe76f34f43bc110387b193 (patch) | |
tree | 2559b6eb41e2c54b15c05cc2b948af2558a6998f /source | |
parent | d8d60e939c571969723e92003888e8040eec31a4 (diff) | |
download | mupdf-a4b58d62b59d95152ebe76f34f43bc110387b193.tar.xz |
clip flate stream on data check error instead of rejecting it wholesale
This is required e.g. for 1798_-_zlib_incorrect_data_check.pdf .
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/filter-flate.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/fitz/filter-flate.c b/source/fitz/filter-flate.c index 73451d59..f2abaf6d 100644 --- a/source/fitz/filter-flate.c +++ b/source/fitz/filter-flate.c @@ -57,6 +57,12 @@ read_flated(fz_stream *stm, unsigned char *outbuf, int outlen) fz_warn(stm->ctx, "ignoring zlib error: %s", zp->msg); return outlen - zp->avail_out; } + else if (code == Z_DATA_ERROR && !strcmp(zp->msg, "incorrect data check")) + { + fz_warn(stm->ctx, "ignoring zlib error: %s", zp->msg); + chain->rp = chain->wp; + return outlen - zp->avail_out; + } else if (code != Z_OK) { fz_throw(stm->ctx, FZ_ERROR_GENERIC, "zlib error: %s", zp->msg); |