[FFmpeg-devel] [libav-devel] [PATCH] apedec: set s->samples only when init_frame_decoder succeeded

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Wed Apr 29 22:52:44 CEST 2015


On 29.04.2015 21:04, Luca Barbato wrote:
> On 28/04/15 00:30, Andreas Cadhalpun wrote:
>> Otherwise range_start_decoding is not necessarily run and thus
>> ctx->rc.range still 0 in range_dec_normalize leading to an infinite
>> loop.
>>
>> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
>> ---
>>  libavcodec/apedec.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
>> index 06f3d3f..f26f8b5 100644
>> --- a/libavcodec/apedec.c
>> +++ b/libavcodec/apedec.c
>> @@ -1461,13 +1461,13 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
>>                     nblocks);
>>              return AVERROR_INVALIDDATA;
>>          }
>> -        s->samples = nblocks;
>>  
>>          /* Initialize the frame decoder */
>>          if (init_frame_decoder(s) < 0) {
>>              av_log(avctx, AV_LOG_ERROR, "Error reading frame header\n");
>>              return AVERROR_INVALIDDATA;
>>          }
>> +        s->samples = nblocks;
>>      }
>>  
>>      if (!s->data) {
>>
> 
> Would be a good idea to reset it to 0 then?

This is under an 'if(!s->samples)', so it is 0 until it's set.
Thus there is no point in reseting to 0.

Best regards,
Andreas


More information about the ffmpeg-devel mailing list