From patchwork Thu Jan 24 06:23:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Pluzhnikov X-Patchwork-Id: 215258 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 82AB52C0040 for ; Thu, 24 Jan 2013 17:23:36 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1359613417; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:From:To:Cc:Subject:Date:Message-ID: MIME-Version:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=/9ruNyZezCAHuxRSg04dsPHIvAY=; b=O3NaWJltkwCM6i8 4ym3VjXKLeyCmYi5EsbMl/60JURsQmbeVn0S+13ov+j+MpTAm8WPJDRbGsEIJg6U Mg4q4FxX6n1jIfj+eWWTc+Jvk+3xVSFyBe5dGax1b0GIi6c51pMGa6ybdzGkvKfP L70MoUJnQ+lQLHr6MYn6O33Ro9mE= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:X-Received:Received:Received:Received:From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:X-Gm-Message-State:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=P62SoIHp2iABCLe0Hmzd2wQXURxvic4fWGWhfjLvsWTVFORXJCiOXtfG9jyeBP WipVKMMpcynWvglTLYxWgMmh/zRzCKH8/1LXs4uqLtLy4gKq1tttMmj+5xcVXSUM +38HHPx8P5FFS9HGH5G8adJ6Ax3gdJRFXzKuCehfsaCVU=; Received: (qmail 7182 invoked by alias); 24 Jan 2013 06:23:29 -0000 Received: (qmail 7173 invoked by uid 22791); 24 Jan 2013 06:23:28 -0000 X-SWARE-Spam-Status: No, hits=-4.8 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-yh0-f74.google.com (HELO mail-yh0-f74.google.com) (209.85.213.74) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 24 Jan 2013 06:23:23 +0000 Received: by mail-yh0-f74.google.com with SMTP id z12so779921yhz.1 for ; Wed, 23 Jan 2013 22:23:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:mime-version :content-type:x-gm-message-state; bh=ZQX+V/vQ6Z1FiM61crF87/kIX6PqinsV0WPJ91wc+u8=; b=FZ16S15O0P1HSQF6BEuu8q1SiRuWO745XcvO7eiAjyen4vntQNwSPAAWR7e+HNxgVw m2si2VBjKykDwCxJUAkB0/VFs3l21gPrRCUe3gF3z7KoGRMS30UxyHj8PcBYdcAjkww0 6LP5UXM+1HFnhhS8rDKP87xs4gzW9J4xchqzvGgixRBT3n+0BKGo+Rv9bgNfJOXHS5G5 aKzhYmFDq9FLdQlPahXTYoqpng7jWIFlyTtGaaFh+bb6YJJWgxit5/IWxoz/NjB3BUIf DWUAhY4/Ug8Fl93z4dL9hSIvDgA0gdJByBlhz2OxUwpMX7CXPWp+rGfRPKCRr+UQt/ix KU+w== X-Received: by 10.101.16.20 with SMTP id t20mr147025ani.8.1359008602266; Wed, 23 Jan 2013 22:23:22 -0800 (PST) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id i27si1015335yhe.4.2013.01.23.22.23.22 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Wed, 23 Jan 2013 22:23:22 -0800 (PST) Received: from elbrus2.mtv.corp.google.com (elbrus2.mtv.corp.google.com [172.17.128.95]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 2239B31C1F8; Wed, 23 Jan 2013 22:23:22 -0800 (PST) Received: by elbrus2.mtv.corp.google.com (Postfix, from userid 74925) id BA7081C4804; Wed, 23 Jan 2013 22:23:21 -0800 (PST) From: Paul Pluzhnikov 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: Wed, 23 Jan 2013 22:23:21 -0800 Message-ID: MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlhgMUnQ30HrMfsOtcjKxKEza9TSQUNljPvdAYnkMvJb3N/NNRf7kyVN5StJjAzeVh5cFud79gaN8F9xUY3k2iCQkEhfR146BeB05BsVZvxkQxH/Txogi1D+aoI3KDl9rjvDv7w3QbS5S3upinCCvI5lzm/3kGqP5Ht8w7K3c6IkABmVbI/aodNj/i4AhMjDkE2RBqyIbG2i3MkGYGB3CA8jFQ5rhDqJn2SSqs2Tuh4OoT0gRM= Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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()