[FFmpeg-devel] [libav-devel] [PATCH 1/2] wmalosslessdec: avoid reading 0 bits with get_bits
Andreas Cadhalpun
andreas.cadhalpun at googlemail.com
Sun Jul 5 20:39:05 CEST 2015
On 03.07.2015 01:19, Luca Barbato wrote:
> On 03/07/15 00:07, Andreas Cadhalpun wrote:
>> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
>> ---
>> libavcodec/wmalosslessdec.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
>> index 843ce90..8094db3 100644
>> --- a/libavcodec/wmalosslessdec.c
>> +++ b/libavcodec/wmalosslessdec.c
>> @@ -488,7 +488,7 @@ static int decode_cdlms(WmallDecodeCtx *s)
>> if ((1 << cbits) < s->cdlms[c][i].scaling + 1)
>> cbits++;
>>
>> - s->cdlms[c][i].bitsend = get_bits(&s->gb, cbits) + 2;
>> + s->cdlms[c][i].bitsend = (cbits ? get_bits(&s->gb, cbits) : 0) + 2;
>> shift_l = 32 - s->cdlms[c][i].bitsend;
>> shift_r = 32 - s->cdlms[c][i].scaling - 2;
>> for (j = 0; j < s->cdlms[c][i].coefsend; j++)
>>
>
> cbits == 0 is valid?
I'm not sure, but it happens when s->cdlms[c][i].scaling is 0.
Best regards,
Andreas
More information about the ffmpeg-devel
mailing list