public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Mikhail Maltsev <maltsevm@gmail.com>,
	gcc-patches <gcc-patches@gnu.org>,
	       Jason Merrill <jason@redhat.com>
Subject: Re: [PATCH 3/7] Fix trinary op
Date: Tue, 07 Jul 2015 22:39:00 -0000	[thread overview]
Message-ID: <559C5547.2020700@redhat.com> (raw)
In-Reply-To: <559AD84C.6080106@gmail.com>

On 07/06/2015 01:34 PM, Mikhail Maltsev wrote:
> ---
>   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<static_cast<bool>(1)>&)
>   _ZNKSt7complexIiE4realB5cxx11Ev
>   std::complex<int>::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.
>
OK with a suitable ChangeLog entry.

And a generic question on the testsuite -- presumably it turns on type 
demangling?    I wanted to verify the flow through d_expression_1 was 
what I expected it to be and it took a while to realize that c++filt 
doesn't demangle types by default, thus Av32_f would demangle to Av32_f 
without ever getting into d_expression_1.

jeff

  reply	other threads:[~2015-07-07 22:39 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-06 19:18 [PATCH 0/7] Fix bugs found during demangler fuzz-testing Mikhail Maltsev
2015-07-06 19:22 ` [PATCH 1/7] Add CHECK_DEMANGLER Mikhail Maltsev
2015-07-06 22:50   ` Jeff Law
2015-07-06 19:24 ` [PATCH 2/7] Fix build with CP_DEMANGLE_DEBUG Mikhail Maltsev
2015-07-06 22:19   ` Jeff Law
2015-07-06 19:26 ` [PATCH 3/7] Fix trinary op Mikhail Maltsev
2015-07-07 22:39   ` Jeff Law [this message]
2015-07-08 10:55     ` Ian Lance Taylor
2015-07-08 13:42       ` Tom Tromey
2015-07-08 13:46         ` Ian Lance Taylor
2015-07-10  4:50       ` Mikhail Maltsev
2015-07-10 20:44         ` Jeff Law
2015-07-13  5:54           ` Mikhail Maltsev
2015-07-06 19:28 ` [PATCH 4/7] Fix int overflow Mikhail Maltsev
2015-07-06 22:55   ` Jeff Law
2015-07-07  0:05     ` Mikhail Maltsev
2015-07-07 22:48       ` Jeff Law
2015-07-08  3:58         ` Mikhail Maltsev
2015-07-08 10:52   ` Ian Lance Taylor
2015-07-06 19:28 ` [PATCH 5/7] Fix braced-init-list demangling Mikhail Maltsev
2015-07-06 22:58   ` Jeff Law
2015-07-06 19:31 ` [PATCH 6/7] Fix DEMANGLE_COMPONENT_LOCAL_NAME Mikhail Maltsev
2015-07-07 22:40   ` Jeff Law
2015-07-06 19:32 ` [PATCH 7/7] Fix several crashes in d_find_pack Mikhail Maltsev
2015-07-07 22:50   ` Jeff Law

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=559C5547.2020700@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gnu.org \
    --cc=jason@redhat.com \
    --cc=maltsevm@gmail.com \
    /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).