On Mon, Jan 4, 2016 at 4:05 PM, Andreas Cadhalpun
<[email protected]> wrote:
> On 05.01.2016 00:51, Ganesh Ajjanagadde wrote:
>> On Mon, Jan 4, 2016 at 3:44 PM, Andreas Cadhalpun
>> <[email protected]> wrote:
>>> Otherwise this can have some surprising effects (crashes), so let's
>>> better not allow it.
>>>
>>> Signed-off-by: Andreas Cadhalpun <[email protected]>
>>> ---
>>>  libavcodec/parser.c | 11 +++++++++++
>>>  1 file changed, 11 insertions(+)
>>>
>>> diff --git a/libavcodec/parser.c b/libavcodec/parser.c
>>> index 2809158..1f38edb 100644
>>> --- a/libavcodec/parser.c
>>> +++ b/libavcodec/parser.c
>>> @@ -141,6 +141,17 @@ int av_parser_parse2(AVCodecParserContext *s, 
>>> AVCodecContext *avctx,
>>>      int index, i;
>>>      uint8_t dummy_buf[AV_INPUT_BUFFER_PADDING_SIZE];
>>>
>>> +    if (avctx->codec_id != s->parser->codec_ids[0] &&
>>> +        avctx->codec_id != s->parser->codec_ids[1] &&
>>> +        avctx->codec_id != s->parser->codec_ids[2] &&
>>> +        avctx->codec_id != s->parser->codec_ids[3] &&
>>> +        avctx->codec_id != s->parser->codec_ids[4]) {
>>
>> Can't you use FFARRAY_ELEMS on codec_ids to make this more generic? No
>> opinion on the change itself.
>
> I don't think that would improve readability.
> Also codec_ids is already used that way in av_parser_init.
>
> Anyway, the array length can't easily change as it's public API.

This is a good point, comment withdrawn.

>
> Best regards,
> Andreas
>
> _______________________________________________
> ffmpeg-devel mailing list
> [email protected]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
_______________________________________________
ffmpeg-devel mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to