On 10/26/2011 01:35 PM, Kostya Shishkov wrote:

> On Wed, Oct 26, 2011 at 07:34:20PM +0200, Kostya Shishkov wrote:
>> On Wed, Oct 26, 2011 at 12:16:21PM -0400, Justin Ruggles wrote:
>>> ---
>>>  libavcodec/mpegaudiodec.c |    3 +++
>>>  1 files changed, 3 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
>>> index 60356bd..d247b66 100644
>>> --- a/libavcodec/mpegaudiodec.c
>>> +++ b/libavcodec/mpegaudiodec.c
>>> @@ -1873,6 +1873,9 @@ static int decode_frame_adu(AVCodecContext * avctx, 
>>> void *data, int *data_size,
>>>          avctx->bit_rate = s->bit_rate;
>>>      avctx->sub_id = s->layer;
>>>  
>>> +    if (*data_size < 1152 * avctx->channels * sizeof(OUT_INT))
>>> +        return AVERROR(EINVAL);
>>> +
>>>      s->frame_size = len;
>>>  
>>>  #if FF_API_PARSE_FRAME
>>> -- 
>>
>> looks reasonable
> 
> but only for Layer I, don't layer II and III have 384 samples per frame?


Layer I:   s->avctx->frame_size = 384;
Layer II:  s->avctx->frame_size = 1152;
Layer III: s->avctx->frame_size = s->lsf ? 576 : 1152;

I can change it to check s->avctx->frame_size instead. The existing
check for non-adu uses 1152, but after checking the code it looks like
it will always output frame_size samples.

Thanks,
Justin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to