[FFmpeg-devel] [PATCH v4] Fix integer parameters size check in SDP fmtp line

Moritz Barsnick barsnick at gmx.net
Wed May 22 16:50:38 EEST 2019


On Wed, May 22, 2019 at 12:03:55 +0200, Olivier Maignial wrote:
> In SDP provided by my RTSP server I had this fmtp line:
>     a=fmtp:98 streamType=5; profile-level-id=40; mode=AAC-hbr; config=1188; sizeLength=13; indexLength=3; indexDeltaLength=3;
>
> In FFmpeg code, I found a check introduced by commit 24130234cd9dd733116d17b724ea4c8e12ce097a. It disallow values greater than 32 for fmtp line parameters.
> However, In RFC-6416 (RTP Payload Format for MPEG-4 Audio/Visual Streams) give examples of "profile-level-id" values for AAC, up to 55.
> Furthermore, RFC-4566 (SDP: Session Description Protocol) do not give any limit of size on interger parameters given in fmtp line.

This explanation is much more concise than before. Thanks. Thus,
understanding the intent, I can now finally comment on the code:

> Using INT_MIN, LONG_MIN, INT_MAX and LON_MAX definitions ensure that it will work whatever the size of int/long given by compiler.
[...]
> +                    long int val = strtol(value, &end_ptr, 10);

According to your comment, you do realize that this depends on the
compiler. I actually believe it depends mainly on the platform, but
that's an academic discussion. Either way, why not support the same
range regardless of compiler or platform? I.e. avoid "long int", which
is sometimes 32 bits, sometimes 64.

(Anything else could lead to
unexpected behavior. In other words, an observation such as: "That's
peculiar, my [64 bit] PC handles this stream just fine, but my [32 bit]
RaspPi doesn't.")

> +                               "Value of field %s overflow maximum integer value.\n",

Singular: "underflows".

> +                               "Value of field %s underflow minimum integer value.\n",

Ditto.

Moritz


More information about the ffmpeg-devel mailing list