On 06/16/2011 11:14 AM, Anton Khirnov wrote:

> 
> On Thu, 16 Jun 2011 11:02:38 -0400, Justin Ruggles <[email protected]> 
> wrote:
>> On 06/16/2011 12:36 AM, Anton Khirnov wrote:
>>
>>> +            if (!output_codecs[i])
>>> +                output_codecs[i] = 
>>> avcodec_find_encoder(ost->st->codec->codec_id);
>>> +
>>
>>
>> You need to check to make sure i < nb_output_codecs.
> 
> Isn't that always true?


Well, I'm pretty sure it is, but it's convoluted. nb_output_codecs is a
global in ffmpeg.c that is incremented for each new stream, and
nb_ostreams (what 'i' is iterated to) is a sum of
AVFormatContext.nb_streams for each stream in each output file. From
what I can tell, av_new_stream() is call the same number of times as
output_codecs is incremented, but I'm not 100% sure there isn't some
condition somewhere that makes this not true.

The current code does check this, and if it happens not to be true then
it will segfault.

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

Reply via email to