[FFmpeg-devel] [PATCH 1/3] 4xm: prevent overflow during bit rate calculation

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Thu Dec 15 02:11:48 EET 2016


On 14.12.2016 02:46, Ronald S. Bultje wrote:
> Not wanting to discourage you, but I wonder if there's really a point to
> this...?

These patches are prerequisites for enforcing the validity of codec
parameters [1].

> I don't see how the user experience changes.

Users won't see ffmpeg claiming nonsense bit rates like -1184293205235990 kb/s
anymore.

> This isn't specifically intended at this patch, but rather at the sort of
> rabbit hole this change might lead to,

I have a pretty good map of this rabbit hole (i.e. lots of samples triggering
UBSan errors) and one day I might try to dig it up, but for now I'm limiting
myself to the codec parameters.

> which would cause the code to be uber-full of such checks, none of which
> really have any significance. But maybe others disagree...

Not relying on undefined behavior is a significant improvement. And doing
these checks consequently where the values are set makes it possible
for other code to rely on their validity without further checks.

Best regards,
Andreas


1: https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161026/c0151e90/attachment.patch


More information about the ffmpeg-devel mailing list