[PATCH] Enforce strict overflow checking
Douglas Bagnall
douglas.bagnall at catalyst.net.nz
Fri May 4 04:29:34 UTC 2018
On 02/03/18 22:02, Andreas Schneider via samba-technical wrote:
> Hello,
>
> in a lot of places we use the incorrect size types, which could lead to
> issues. This is mostly int vs. size_t.
>
> -Werror=strict-overflow -Wstrict-overflow=2
>
> this allows us to use enforce the correct size types. We could discuss moving
> to -Wstrict-overflow=3 but higher values don't make sense. You also get a
> false positives with 4 or 5.
Since this, I get errors running autobuild on Ubuntu 16.04:
../source4/heimdal/lib/hcrypto/libtommath/bn_mp_rshd.c:55:5: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
for (x = 0; x < (a->used - b); x++) {
^
and Centos 6:
[ 632/4144] Compiling lib/replace/test/os2_delete.c
../lib/replace/test/os2_delete.c: In function ‘os2_delete’:
../lib/replace/test/os2_delete.c:77: error: assuming signed overflow does not occur when simplifying conditional to constant
cc1: warnings being treated as errors
As far as I can tell, the centos-6 one is gcc 4.4 being blindingly stupid.
The 16.04 one would be avoided if -Werror turned a blind eye to Heimdal,
which I thought already happened.
I am not fixing these with any urgency.
cheers,
Douglas
More information about the samba-technical
mailing list