[FFmpeg-devel] [PATCH] ffmdec: sanitize codec parameters

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Tue Nov 22 01:06:39 EET 2016

On 20.11.2016 21:02, Carl Eugen Hoyos wrote:
> 2016-11-20 20:40 GMT+01:00 Andreas Cadhalpun <andreas.cadhalpun at googlemail.com>:
>> Currently many demuxers silently accept wrong (i.e. negative) values
>> for channels, bit_rate, block_align and so on. I'd like to fix that,
>> so the question is now, how?
>> There are a few possibilities:
>> a) error out for negative values and also for zero
> Only if -fstrict strict was set.
>> b) error out for negative values, silently accept zero
> Only if -fstrict strict was set.

So you have no preference between accepting zero or not?

I tend to silently accept zero, because I'd like a
consistent solution and in some cases rejecting zero
causes FATE failures.
If a zero causes SIGFPE crashes, it obviously needs to
be rejected with an error.

I also like the idea to only error out if strict is set
and otherwise only warn.

>> c) warn for negative values and also for zero
>> d) warn for negative values, silently accept zero
> I obviously cannot stop you if you feel this should
> be done, but note that users will report regressions
> "warnings are shown for playable files".

Isn't that a good thing?

Because either our demuxer has a bug and should be fixed,
or some other tool created broken files, and if ffmpeg
informs it's users about that, they can try to get that
tool fixed.

>> e) something else
> Broken files exist and FFmpeg should play them if
> reasonable.

I agree in principle.

Best regards,

More information about the ffmpeg-devel mailing list