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 a9decb5584)

Change-Id: I628e2c39c64f10c443fb51f86b1f5919cc9fd299
This commit is contained in:
Pascal Massimino 2014-09-05 20:21:17 +02:00 committed by James Zern
parent e6609ac6b9
commit 2e4312b14f

View File

@ -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) {