This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C++ interop issue due to non-null pointers
- From: Florian Weimer <fweimer at redhat dot com>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: GCC <gcc at gcc dot gnu dot org>
- Date: Tue, 17 Jun 2014 14:41:38 +0200
- Subject: Re: C++ interop issue due to non-null pointers
- Authentication-results: sourceware.org; auth=none
- References: <53997584 dot 8080706 at redhat dot com> <CAH6eHdRua1KTs1QXf2Pu39orxCx6agdzwdzVvcPkcNVEEkRErA at mail dot gmail dot com>
On 06/12/2014 12:04 PM, Jonathan Wakely wrote:
What can we do about it?
How common is it to use std::vector with qsort, rather than
std::sort(vec.begin(), vec.end()), which does the right thing?
Our very own vec::qsort has the same problem, so I'd wager that it's
fairly common.
We could make vector::data() guarantee a non-null pointer with
_FORTIFY_SOURCE, but I'd rather not do so in "unfortified" code. Some
users would object to the extra check needed.
Or we could remove the nonnull attributes, so that the additional checks
are not necessary.
--
Florian Weimer / Red Hat Product Security Team