This is the mail archive of the
mailing list for the GCC project.
Re: US-CERT Vulnerability Note VU#162289
- From: "Robert C. Seacord" <rcs at cert dot org>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: mark at codesourcery dot com, gcc at gcc dot gnu dot org, Chad Dougherty <crd at cert dot org>
- Date: Mon, 12 May 2008 15:11:11 -0400
- Subject: Re: US-CERT Vulnerability Note VU#162289
- References: <47FA59B5.email@example.com> <firstname.lastname@example.org>
Sounds great, thanks, I'll work with Chad to get the vul note updated
"Robert C. Seacord" <email@example.com> writes:
Once a new version or patch is available that will warn users that
this optimization is taking place, I will recommend that we change the
work around from "Avoid newer versions of gcc" to "Avoid effected
versions of gcc" and/or recommend that users download the patch /
The behaviour of pointer overflow has now changed as of the following
(as yet unreleased) versions:
and all subsequent versions (4.2.x where x >= 4, 4.3.y where y >= 1,
4.z where z >= 4).
The optimization under discussion is for comparisons between P + V1
and P + V2, where P is the same pointer and V1 and V2 are variables of
some integer type. The C/C++ language standards permit this to be
reduced to a comparison between V1 and V2. However, if V1 or V2 are
such that the sum with P overflows, then the comparison of V1 and V2
will not yield the same result as actually computing P + V1 and P + V2
and comparing the sums.
The new behaviour as of the above releases is that this optimization
is performed by default at -O2 and above, including -Os. It is not
performed by default at -O1 or (of course) -O0. The optimization may
be enabled for -O1 with the -fstrict-overflow option. The
optimization may be disabled for -O2 and above with the
When the optimization is enabled, cases where it occurs may be
detected by using -Wstrict-overflow=N where N >= 3. Note that using
this warning option is likely to yield a number of false positive
reports--cases where this or other overflow optimizations are being
applied, but where there is no actual problem.
Please see the gcc manual for more information about these options.