summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Bünzli <zeniko@gmail.com>2013-08-18 13:17:25 +0200
committerRobin Watts <robin.watts@artifex.com>2013-08-28 13:35:49 +0100
commite5451f0cb4cadeae01769221fe7f505ca155b9a1 (patch)
tree4a61d0b5bea81d19c14959f20d2d53e7edd4dd29
parent4f20460b94053d10a464b565f772f07e93748e24 (diff)
downloadmupdf-e5451f0cb4cadeae01769221fe7f505ca155b9a1.tar.xz
sync bits when closing an LZW stream
Content streams may contain multiple inline images compressed as LZW data. The LZW filter used for such inline images might in some cases be closed in a state where less than 8 bits remain unread. The parent stream remembers that number (in stream->avail) and uses it again when reading the next inline image instead of resetting the remaining bit count when reading the next entire byte after the first inline image (or resetting it when closing the LZW stream as this patch does).
-rw-r--r--source/fitz/filter-lzw.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/source/fitz/filter-lzw.c b/source/fitz/filter-lzw.c
index 73909ca1..63d6555b 100644
--- a/source/fitz/filter-lzw.c
+++ b/source/fitz/filter-lzw.c
@@ -169,6 +169,7 @@ static void
close_lzwd(fz_context *ctx, void *state_)
{
fz_lzwd *lzw = (fz_lzwd *)state_;
+ fz_sync_bits(lzw->chain);
fz_close(lzw->chain);
fz_free(ctx, lzw);
}