On 9 March 2015 at 12:41, Andreas Cadhalpun <
andreas.cadhal...@googlemail.com> wrote:

> On 09.03.2015 10:53, Lukasz Marek wrote:
>
>> In fact this is a bit wrong. COMM is guaranteed unless malformed file is
>> parsed. These variables are dedicated to detect doubled sections. This
>> patch allows them to occur twice in that case. So they should be
>> initialized to 0.
>>
>
> This patch doesn't change anything for valid files, it only prevents
> crashes with malformed files.
>
> For valid files, these variables are initialized to -1, then set to 0 in
> the COMM part of the switch.
>
> For invalid files, if another section comes before COMM, the counter is
> -1, thus e.g. 'if (f_stvi++)' is true and AVERROR(EINVAL) is returned.
>
> If they were initialized to 0, the check wouldn't trigger for malformed
> files, leading to crashes, because codec is not set.
>

OK.
BTW, did you produced this malformed file using ffmpeg tools or just
prevent theoretical case?
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to