diff options
Diffstat (limited to 'src/bitstream.c')
-rw-r--r-- | src/bitstream.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bitstream.c b/src/bitstream.c index 71a3d75..dc8109b 100644 --- a/src/bitstream.c +++ b/src/bitstream.c @@ -257,7 +257,10 @@ h_rewindNbits (huffdec_bitbuf * bb, guint N) bb->buf_bit_idx = 0; bits = 8 - (N % 8); bytes = (N + 8 + BS_ACUM_SIZE) >> 3; - bb->buf_byte_idx -= bytes; + if (bb->buf_byte_idx >= bytes) + bb->buf_byte_idx -= bytes; + else + bb->buf_byte_idx = 0; bb->remaining += bytes; h_getbits (bb, bits); } |