Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(663)

Issue 4973065: [patch][google/integration] Add lightweight checks to vector::begin et. al.

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 2 months ago by ppluzhnikov
Modified:
13 years, 2 months ago
Reviewers:
jwakely, Diego Novillo, caj21, pedro
CC:
gcc-patches_gcc.gnu.org
Base URL:
svn+ssh://gcc.gnu.org/svn/gcc/branches/google/integration/libstdc++-v3/
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+66 lines, -7 lines) Patch
M include/bits/stl_vector.h View 9 chunks +62 lines, -7 lines 0 comments Download
M include/bits/vector.tcc View 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 17
ppluzhnikov
Greetings, This patch adds a lightweight self-consistency check to many vector operations. Google issue 5246356. ...
13 years, 2 months ago (2011-09-06 16:28:56 UTC) #1
ppluzhnikov
On Tue, Sep 6, 2011 at 9:28 AM, Paul Pluzhnikov <ppluzhnikov@google.com> wrote: > This patch ...
13 years, 2 months ago (2011-09-06 16:42:05 UTC) #2
Diego Novillo
On Tue, Sep 6, 2011 at 12:28, Paul Pluzhnikov <ppluzhnikov@google.com> wrote: > Greetings, > > ...
13 years, 2 months ago (2011-09-06 16:44:40 UTC) #3
ppluzhnikov
On Tue, Sep 6, 2011 at 9:44 AM, Diego Novillo <dnovillo@google.com> wrote: > OK. Any ...
13 years, 2 months ago (2011-09-06 16:54:52 UTC) #4
Diego Novillo
On Tue, Sep 6, 2011 at 12:54, Paul Pluzhnikov <ppluzhnikov@google.com> wrote: > On Tue, Sep ...
13 years, 2 months ago (2011-09-06 17:46:35 UTC) #5
ppluzhnikov
On Tue, Sep 6, 2011 at 10:46 AM, Diego Novillo <dnovillo@google.com> wrote: > On Tue, ...
13 years, 2 months ago (2011-09-06 18:01:45 UTC) #6
jwakely
On 6 September 2011 19:01, Paul Pluzhnikov wrote: > >> But this is something to ...
13 years, 2 months ago (2011-09-06 19:23:48 UTC) #7
jwakely
On 6 September 2011 20:23, Jonathan Wakely wrote: > > What's a dangling vector anyway? ...
13 years, 2 months ago (2011-09-06 19:44:43 UTC) #8
ppluzhnikov
On Tue, Sep 6, 2011 at 12:44 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote: > On 6 ...
13 years, 2 months ago (2011-09-06 20:20:04 UTC) #9
caj21_st-andrews.ac.uk
On 6 Sep 2011, at 21:19, Paul Pluzhnikov wrote: > On Tue, Sep 6, 2011 ...
13 years, 2 months ago (2011-09-06 20:29:06 UTC) #10
jwakely
On 6 September 2011 21:19, Paul Pluzhnikov wrote: > On Tue, Sep 6, 2011 at ...
13 years, 2 months ago (2011-09-06 20:33:49 UTC) #11
ppluzhnikov
On Tue, Sep 6, 2011 at 1:33 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote: >> for (it ...
13 years, 2 months ago (2011-09-06 20:52:54 UTC) #12
jwakely
On 6 September 2011 21:52, Paul Pluzhnikov wrote: > On Tue, Sep 6, 2011 at ...
13 years, 2 months ago (2011-09-06 21:51:21 UTC) #13
ppluzhnikov
On Tue, Sep 6, 2011 at 2:51 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote: > I don't ...
13 years, 2 months ago (2011-09-06 21:59:05 UTC) #14
jwakely
On 6 September 2011 22:58, Paul Pluzhnikov wrote: > On Tue, Sep 6, 2011 at ...
13 years, 2 months ago (2011-09-06 22:09:17 UTC) #15
pedro_codesourcery.com
On Tuesday 06 September 2011 23:09:17, Jonathan Wakely wrote: > On 6 September 2011 22:58, ...
13 years, 2 months ago (2011-09-07 09:34:42 UTC) #16
ppluzhnikov
13 years, 2 months ago (2011-09-07 15:07:58 UTC) #17
On Wed, Sep 7, 2011 at 2:34 AM, Pedro Alves <pedro@codesourcery.com> wrote:

> Zeroing out would hide bugs; there's lots of code that does
>
> delete ptr;
> ...
> if (ptr)
>  {
>   ptr->...
>  }
>
> You'd not see the bug that way.  Making 'delete v' clobber the pointer
> with 0xdeadbeef or ~0 instead would be better.

Right. In practice, I don't believe I've ever seen this bug in such a
"pure" form though.

What I often see is

  ptr = new Foo;
  DoSomethingInAnotherThread(ptr);
...
  delete ptr; // Oops. Didn't wait for another thread to finish
}

Or

  ptr = new Foo;
  DoSomethingThatDeletes(ptr);
  ptr->x++;  // Oops. Use after free


AFAICT, neither of these would be helped by delete stomping on the pointer.

-- 
Paul Pluzhnikov
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b