[FFmpeg-devel] [PATCH] Fix MSVC warnings about possible value truncation.

Peter Kasting pkasting at google.com
Tue Sep 2 22:13:27 CEST 2014


On Sat, Aug 30, 2014 at 2:21 AM, wm4 <nfxjfg at googlemail.com> wrote:

> Littering the code with casts doesn't seem like a very good idea.
>

Not everything in the patch is a cast addition.  Even some of the ones that
currently are perhaps shouldn't be.  I'm concerned that this warning may
have exposed real bugs in the code.  I'm asking for help evaluating whether
the identified sites are actually problematic because I don't have
sufficient expertise to judge.

It seems a bit like most of the responses in this thread are working from
an assumption that the existing code is OK, and this is just about adding
code cruft to silence an unimportant warning.  If that were the case, I
would be more sympathetic to the skepticism raised.  But I think there are
potentially real issues here.  Is no one willing to work with me on going
through the patch and evaluating the emitted warnings?  If after that
process it's clear this adds no value and is unlikely to catch any real
problems, I'll happily withdraw the patch and simply silence the warning
for Chromium's FFMPEG build.


> I'd
> expect it rather to hide bugs than to expose them. For example, it
> could make a static analyzer with value range analysis stop working,
> because the casts will basically throw a wrench into its algorithm.


I can't understand how the sorts of casts that would be introduced here.
I'm suggesting would harm static analysis.  If we're assigning a value to a
variable of type T, then "T var = x;" and "T var = (T)x;" have the same
effect, and a static analyzer ought to treat them identically.

PK


More information about the ffmpeg-devel mailing list