public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paul Pluzhnikov <ppluzhnikov@google.com>
To: dnovillo@google.com, gcc-patches@gcc.gnu.org
Cc: ppluzhnikov@google.com
Subject: [google gcc-4_7, integration] Scribble on destructed strings to catch invalid accesses.
Date: Thu, 24 Jan 2013 06:23:00 -0000	[thread overview]
Message-ID: <ye6qy5fjcd5y.fsf@elbrus2.mtv.corp.google.com> (raw)

This patch allows us to catch use of destructed strings.

Google ref: b/5430313

Ok for google/gcc-4_7 and google/integration?

--
Paul Pluzhnikov



Index: libstdc++-v3/include/ext/sso_string_base.h
===================================================================
--- libstdc++-v3/include/ext/sso_string_base.h	(revision 195417)
+++ libstdc++-v3/include/ext/sso_string_base.h	(working copy)
@@ -215,7 +215,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 			  const _Alloc& __a);
 
       ~__sso_string_base()
-      { _M_dispose(); }
+      {
+          _M_dispose();
+#ifdef __google_stl_debug_dangling_string
+          __builtin_memset(this, 0xcd, sizeof(*this));
+#endif
+      }
 
       _CharT_alloc_type&
       _M_get_allocator()

             reply	other threads:[~2013-01-24  6:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-24  6:23 Paul Pluzhnikov [this message]
2013-01-24 12:08 ` Diego Novillo
2013-01-24 19:03 ` Marc Glisse
2013-01-25  0:15   ` Jonathan Wakely
2013-01-25 13:49     ` Diego Novillo
2013-01-25 14:52     ` Paul Pluzhnikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ye6qy5fjcd5y.fsf@elbrus2.mtv.corp.google.com \
    --to=ppluzhnikov@google.com \
    --cc=dnovillo@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).