This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: detecting "container overflow" bugs in std::vector


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]