[FFmpeg-devel] [PATCH 1/8] ffmdec: initialize f_cprv, f_stvi and f_stau
andreas.cadhalpun at googlemail.com
Mon Mar 9 12:41:54 CET 2015
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.
More information about the ffmpeg-devel