From e5451f0cb4cadeae01769221fe7f505ca155b9a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20B=C3=BCnzli?= Date: Sun, 18 Aug 2013 13:17:25 +0200 Subject: 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). --- source/fitz/filter-lzw.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/fitz/filter-lzw.c') 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); } -- cgit v1.2.3