summaryrefslogtreecommitdiff
path: root/fitz/filt_flate.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2009-07-18 14:49:41 +0200
committerTor Andersson <tor@ghostscript.com>2009-07-18 14:49:41 +0200
commit1d3a42a1dec236c88b01ab59f59e246eb91445bd (patch)
tree1cd70cbdaa577185eb8b06961052c2a432630274 /fitz/filt_flate.c
parent7ef9eebe231668caeeb615e3b21cc7e44af2d412 (diff)
downloadmupdf-1d3a42a1dec236c88b01ab59f59e246eb91445bd.tar.xz
Always call inflate() with Z_FINISH when we run out of input data.
Diffstat (limited to 'fitz/filt_flate.c')
-rw-r--r--fitz/filt_flate.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fitz/filt_flate.c b/fitz/filt_flate.c
index 67158d5e..c9e6698b 100644
--- a/fitz/filt_flate.c
+++ b/fitz/filt_flate.c
@@ -95,6 +95,10 @@ fz_processflated(fz_filter *f, fz_buffer *in, fz_buffer *out)
err = inflate(zp, Z_NO_FLUSH);
+ /* Make sure we call it with Z_FINISH at the end of input */
+ if (err == Z_OK && in->eof && zp->avail_in == 0 && zp->avail_out > 0)
+ err = inflate(zp, Z_FINISH);
+
in->rp = in->wp - zp->avail_in;
out->wp = out->ep - zp->avail_out;