From 2e4312b14f8c5d0753bf9fecbdbd0ccfe07eb2e0 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Fri, 5 Sep 2014 20:21:17 +0200 Subject: [PATCH] Lossless decoding: fix eos_ flag condition eos_ needs to be set only when superfluous bits have actually been requested. Earlier, we were assuming pre-mature end-of-stream to be an error. Now, more precisely, we mark error when we have encountered end-of-stream *and* we attempt to read more bits after that. This handles cases where image data requires no bits to be read (cherry picked from commit a9decb5584dccf74e2fefd37cefc59d786834771) Change-Id: I628e2c39c64f10c443fb51f86b1f5919cc9fd299 --- src/utils/bit_reader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/bit_reader.c b/src/utils/bit_reader.c index 87b4f462..5daa6877 100644 --- a/src/utils/bit_reader.c +++ b/src/utils/bit_reader.c @@ -154,7 +154,7 @@ void VP8LInitBitReader(VP8LBitReader* const br, const uint8_t* const start, // Special version that assumes br->pos_ <= br_len_. static int IsEndOfStreamSpecial(const VP8LBitReader* const br) { assert(br->pos_ <= br->len_); - return br->pos_ == br->len_ && br->bit_pos_ >= LBITS; + return br->pos_ == br->len_ && br->bit_pos_ > LBITS; } static int IsEndOfStream(const VP8LBitReader* const br) {