put_bits: fix invalid shift by 32 in flush_put_bits()
If flush_put_bits() is called when the 32-bit buffer is empty,
e.g. after writing a multiple of 32 bits, and invalid shift by
32 is performed. Since flush_put_bits() is called infrequently,
this additional check should have negligible performance impact.
Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit ac6eab1496
)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:

committed by
Reinhard Tartler

parent
4faa00b256
commit
e52e85ac3a
@@ -100,7 +100,8 @@ static inline void flush_put_bits(PutBitContext *s)
|
||||
align_put_bits(s);
|
||||
#else
|
||||
#ifndef BITSTREAM_WRITER_LE
|
||||
s->bit_buf<<= s->bit_left;
|
||||
if (s->bit_left < 32)
|
||||
s->bit_buf<<= s->bit_left;
|
||||
#endif
|
||||
while (s->bit_left < 32) {
|
||||
/* XXX: should test end of buffer */
|
||||
|
Reference in New Issue
Block a user