[FFmpeg-devel] [PATCH 1/8] ffmdec: initialize f_cprv, f_stvi and f_stau
lukasz.m.luki2 at gmail.com
Mon Mar 9 13:20:14 CET 2015
On 9 March 2015 at 12:41, Andreas Cadhalpun <
andreas.cadhalpun at 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.
BTW, did you produced this malformed file using ffmpeg tools or just
prevent theoretical case?
More information about the ffmpeg-devel