[FFmpeg-devel] [libav-devel] [PATCH] on2avc: limit number of bits to 30 in get_egolomb

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Thu Dec 17 23:21:29 CET 2015


On 16.12.2015 22:26, Luca Barbato wrote:
> On 16/12/15 20:20, Andreas Cadhalpun wrote:
>> More don't fit into the integer output.
>>
>> Also use get_bits_long, since get_bits only supports reading up to 25
>> bits, while get_bits_long supports the full integer range.
>>
>> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
>> ---
>>  libavcodec/on2avc.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavcodec/on2avc.c b/libavcodec/on2avc.c
>> index 15f4dd1..10861b5 100644
>> --- a/libavcodec/on2avc.c
>> +++ b/libavcodec/on2avc.c
>> @@ -211,9 +211,9 @@ static inline int get_egolomb(GetBitContext *gb)
>>  {
>>      int v = 4;
>>  
>> -    while (get_bits1(gb)) v++;
>> +    while (get_bits1(gb) && v < 30) v++;
>>  
>> -    return (1 << v) + get_bits(gb, v);
>> +    return (1 << v) + get_bits_long(gb, v);
>>  }
>>  
>>  static int on2avc_decode_pairs(On2AVCContext *c, GetBitContext *gb, float *dst,
>>
> 
> Which is the actual range of acceptable values?

According to what?

The only documentation I found for on2avc says [1]:
"Additionally, for codeset 15 values -16 and 16 are escape values. In case those
escape values happen, real values are read as exp-Golomb plus three additional bits
and the sign should be the same as the sign of escape value."

This doesn't mention a limit, but since the return value is an integer, larger
values can't be represented.

Best regards,
Andreas


1: http://wiki.multimedia.cx/index.php?title=On2_Audio_for_Video_Codec


More information about the ffmpeg-devel mailing list