From f8fad4fac19d647859986cbee8ab8d757eb9f39e Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Tue, 28 Feb 2017 13:48:04 -0800 Subject: [PATCH] lossless incremental decoding: fix missing eos_ test The patch 21735e0 introduced a bug where a goto path was not testing the eos_ state. If this happened just before a row_sync, a SaveState() would be called that would store the eos_ state as '1' till the end of the loop. This usually was not a problem, except for the very last chunk where we disable the incremental decoding altogether (we have all the data). The termination tests were then going wrong. The fix is to add a proper eos_ test and avoid falling in this inconsistent state. (https://chromium.googlesource.com/webm/libwebp/+/21735e06f7c1cb35562754e7f54365f24124ef15) BUG=webp:332 Change-Id: Ib16773aee26bfd068fbf4e9db3d2313bd978b269 --- src/dec/vp8l_dec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dec/vp8l_dec.c b/src/dec/vp8l_dec.c index c6c2a010..fe467abd 100644 --- a/src/dec/vp8l_dec.c +++ b/src/dec/vp8l_dec.c @@ -1091,6 +1091,7 @@ static int DecodeImageData(VP8LDecoder* const dec, uint32_t* const data, VP8LFillBitWindow(br); if (htree_group->use_packed_table) { code = ReadPackedSymbols(htree_group, br, src); + if (VP8LIsEndOfStream(br)) break; if (code == PACKED_NON_LITERAL_CODE) goto AdvanceByOne; } else { code = ReadSymbol(htree_group->htrees[GREEN], br);