From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20391 invoked by alias); 28 May 2014 22:56:54 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 20269 invoked by uid 89); 28 May 2014 22:56:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=unavailable version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 May 2014 22:56:52 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4SMulOM031202 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 May 2014 18:56:47 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s4SMujgk025921; Wed, 28 May 2014 18:56:46 -0400 Message-ID: <538669AD.8020502@redhat.com> Date: Wed, 28 May 2014 22:56:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Andrew Burgess , gcc-patches@gcc.gnu.org CC: gdb-patches@sourceware.org Subject: Re: [PATCH] demangler, only access valid fields for DEMANGLE_COMPONENT_FIXED_TYPE. References: <1401309510-10507-1-git-send-email-aburgess@broadcom.com> In-Reply-To: <1401309510-10507-1-git-send-email-aburgess@broadcom.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-05/txt/msg00711.txt.bz2 On 05/28/2014 09:38 PM, Andrew Burgess wrote: > In two places when a struct demangle_component is of type > DEMANGLE_COMPONENT_FIXED_TYPE we fall back to accessing the default > s_binary member of the union rather than the s_fixed member. This is > incorrect and can cause the demangler to crash. > > In d_dump I've changed the code to only access the s_fixed member of the > union, and also added printing of the remaining parts of the s_fixed > struct, this felt like the most useful thing to do. > > I've added a new test, this causes a SIGSEGV for me before the patch, and > is fine afterwords, however, this undefined, so might not cause a crash on > all platforms. Hi Andrew, As you know, I'm not a demangler maintainer, but in any case, I took a look and this looks good to me. > diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected > index 453f9a3..0e2bb12 100644 > --- a/libiberty/testsuite/demangle-expected > +++ b/libiberty/testsuite/demangle-expected > @@ -4343,3 +4343,9 @@ cereal::detail::InputBindingMap::Serializers cereal::p > --format=gnu-v3 > _ZNSt9_Any_data9_M_accessIPZ4postISt8functionIFvvEEEvOT_EUlvE_EERS5_v > void post >(std::function&&)::{lambda()#1}*& std::_Any_data::_M_access >(void post >(std::function&&)::{lambda()#1}*&&)::{lambda()#1}*>() > +# The following input symbol was found during random, it caused a fault Could you add a single empty # above, to separate the tests? I find that that makes it much easier to follow the file. I have no idea why we can't have/handle real empty lines though. > +# The following input symbol was found during random, it caused a fault "during random testing?" > +# within the demangler, it's not a symbol we'd expect in the real world. Why not? > +--format=auto --no-params > +_Z3xxxDFyuVb > +xxx(unsigned long long _Fract, bool volatile) > +xxx -- Pedro Alves