From patchwork Mon Jul 6 19:34:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Maltsev X-Patchwork-Id: 491788 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5ED601402D4 for ; Tue, 7 Jul 2015 05:26:09 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=I09+2pW2; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; q=dns; s= default; b=SdBP1oeCs4RGXvzX3aU7RbR/cMzObekg9GycBRzCYgQA95u8voOqK Hc0qKP6hGNj2uxqEnX5/ALJlAJtMU8xnRv4QGxD8ZbZ86hCMsuXdG0c85wr+RJTF LlSWCSvmP2n/BxkwF3iSAwrcWXimY4dLBauJE2zPPLK4TgQcO7Ul7M= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; s=default; bh=DrL6+ahkvfXO2qhndwqYdKdqkGY=; b=I09+2pW23r7l67ihWQ6HHnnf1JaU 5c1PclCIbWlOVNVg3UW1k/2ZWDfCwSi9R3p/sVZb6f9RNcf9t2lsBor8ApQY7TGZ 3LyWpm0UnmcRMglvExVyl8giaDGAHvpzRFbaAoYqj7z72W/+yQ2UoCqOOmAlza4y gIvZ48TN8EnpewE= Received: (qmail 39133 invoked by alias); 6 Jul 2015 19:26:02 -0000 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 Received: (qmail 39118 invoked by uid 89); 6 Jul 2015 19:26:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 06 Jul 2015 19:25:57 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55885) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ZCC1b-0002OK-IB for gcc-patches@gnu.org; Mon, 06 Jul 2015 15:25:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCC1a-0004xr-3X for gcc-patches@gnu.org; Mon, 06 Jul 2015 15:25:55 -0400 Received: from mail-la0-x236.google.com ([2a00:1450:4010:c03::236]:33770) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCC1Z-0004wx-RR for gcc-patches@gnu.org; Mon, 06 Jul 2015 15:25:54 -0400 Received: by laar3 with SMTP id r3so168394095laa.0 for ; Mon, 06 Jul 2015 12:25:53 -0700 (PDT) X-Received: by 10.152.23.4 with SMTP id i4mr396531laf.51.1436210752948; Mon, 06 Jul 2015 12:25:52 -0700 (PDT) Received: from ?IPv6:2a00:1148:b0ba:629:e23f:49ff:fe10:1e6b? ([2a00:1148:b0ba:629:e23f:49ff:fe10:1e6b]) by mx.google.com with ESMTPSA id su8sm2054402lbc.41.2015.07.06.12.25.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 12:25:52 -0700 (PDT) Message-ID: <559AD84C.6080106@gmail.com> Date: Mon, 06 Jul 2015 22:34:36 +0300 From: Mikhail Maltsev User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.6.0 MIME-Version: 1.0 To: gcc-patches , Jason Merrill Subject: [PATCH 3/7] Fix trinary op References: <559AD66D.1070809@gmail.com> In-Reply-To: <559AD66D.1070809@gmail.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::236 X-IsSubscribed: yes --- libiberty/cp-demangle.c | 4 +++- libiberty/testsuite/demangle-expected | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 12093cc..44a0a9b 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -3267,7 +3267,9 @@ d_expression_1 (struct d_info *di) struct demangle_component *second; struct demangle_component *third; - if (!strcmp (code, "qu")) + if (code == NULL) + return NULL; + else if (!strcmp (code, "qu")) { /* ?: expression. */ first = d_expression_1 (di); diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index 6ea64ae..47ca8f5 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -4091,6 +4091,12 @@ void g<1>(A<1>&, B(1)>&) _ZNKSt7complexIiE4realB5cxx11Ev std::complex::real[abi:cxx11]() const # +# Some more crashes revealed by fuzz-testing: +# Check for NULL pointer when demangling trinary operators +--format=gnu-v3 +Av32_f +Av32_f +# # Ada (GNAT) tests. # # Simple test.