mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-20 12:50:49 +08:00
avformat/av1: fix uvlc loop past end of bitstream
When get_bits_left() returns a negative value (bitstream reader already past the end of the buffer), the while condition while (get_bits_left(gb)) evaluates to true since any non-zero int is truthy. With the safe bitstream reader enabled, get_bits1() returns 0 past the buffer end, so the break never triggers and leading_zeros increments toward INT_MAX. Change the condition to > 0, consistent with skip_1stop_8data_bits() which already uses <= 0 for the same pattern. Signed-off-by: Linke <1102336121@qq.com>
This commit is contained in:
@@ -126,8 +126,8 @@ static inline void uvlc(GetBitContext *gb)
|
||||
{
|
||||
int leading_zeros = 0;
|
||||
|
||||
while (get_bits_left(gb)) {
|
||||
if (get_bits1(gb))
|
||||
while (leading_zeros < 32) {
|
||||
if (get_bits_left(gb) < 1 || get_bits1(gb))
|
||||
break;
|
||||
leading_zeros++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user