This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: detecting "container overflow" bugs in std::vector
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Konstantin Serebryany <konstantin dot s dot serebryany at gmail dot com>
- Cc: libstdc++ at gcc dot gnu dot org, GCC Patches <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>, Paul Pluzhnikov <ppluzhnikov at google dot com>
- Date: Mon, 26 May 2014 15:12:30 +0100
- Subject: Re: detecting "container overflow" bugs in std::vector
- Authentication-results: sourceware.org; auth=none
- References: <CAGQ9bdyUm0c7g=kUmTonm3myB24ESjwnwYAH3xS9FxbrBvSEyw at mail dot gmail dot com>
On 26/05/14 17:40 +0400, Konstantin Serebryany wrote:
Would you consider a patch similar to [4] for libstdc++ trunk?
If yes, any comments on the patch?
+ // When sanitizer annotataions are off, avoid bazillion of no-op
^^^^^^^^^^^^
I'd rather see the member functions use our consistent naming
conventions.
The function parameters in the __is_same_allocator<T,U> case should be
unnamed, to avoid warnings with -Wsystem-headers.
The __old_size variable should be marked __attribute((unused)) too, or
just get rid of it and pass size() - 1 to the annotate function.
The current patch has a (minor) problem that affects only code with
exceptions [5].
So "only" most C++ code then. That's not minor.
Not everyone turns off exceptions like Google.
If the libstdc++ team is generally ok with the idea I will work on the
updated patch
and send it for review.
It does look useful but I'm concerned about a proliferation of
container checks, we already have the libstdc++ Debug Mode, and I'd
like to see some of the lightweight checks from the Google branch
added to trunk too.
The exception problem is a showstopper, but should be fixable with
some RAII.