[FFmpeg-devel] [PATCH] Stricter TMV probe

Reimar Döffinger Reimar.Doeffinger
Mon Sep 14 22:25:26 CEST 2009

On Mon, Sep 14, 2009 at 04:05:34PM -0400, Ronald S. Bultje wrote:
> Hi,
> On Mon, Sep 14, 2009 at 3:51 PM, Reimar D?ffinger
> <Reimar.Doeffinger at gmx.de> wrote:
> > Not really related to this specific patch, just because every probe
> > function checks sample_rate:
> > A lot of demuxers (including that one) do not validate it in
> > read_header, ending up with 1/0 as time base. That really is not ok (and
> > as said, I have the impression a lot of demuxers do that).
> I think just checking for != 0 isn't enough. A samplerate of 1 might
> be valid, but isn't. I mean, it wouldn't produce anything audible. A
> min. samplerate of e.g. 1000 seems appropriate, and for many gaming
> formats, a max of e.g. 192000 might also be useful.
> Similar restrictions might apply to other properties.

Checking for != 0 is certainly enough to avoid division by 0, and the
fact that it causes a crash makes it _necessary_ to handle it (how is a
different question, failing or setting some default value?).
Anything else is a completely different beast, creating questions like:
- Is this a real-world issue worth the code?
- Is what you do instead of just accepting the value actually any better?
- Are you maybe second-guessing users who actually know better than you?
- Are you really sure that 1000 is the lowest value that makes sense?
  Or should it be 2000? Or 800? Or...
Thus I object to considering these two issues as related.

More information about the ffmpeg-devel mailing list