public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Iain Buclaw <ibuclaw@gdcproject.org>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
	Ian Lance Taylor <iant@google.com>
Subject: Re: [PATCH 2/7] [D] libiberty: Fail if reached end of symbol string
Date: Thu, 14 May 2015 15:05:00 -0000	[thread overview]
Message-ID: <5554B68A.1020900@redhat.com> (raw)
In-Reply-To: <CABOHX+fjsacfGx5UvHR1L_g54Zpk+AOYX03zLCArDBmUJpVjcQ@mail.gmail.com>

On 05/14/2015 07:36 AM, Iain Buclaw wrote:
> On 14 May 2015 at 14:58, Jeff Law <law@redhat.com> wrote:
>> On 05/13/2015 02:51 AM, Iain Buclaw wrote:
>>>
>>> If a symbol that has so far been valid abruptly ends then we will want
>>> to fail the process rather than silently succeed.
>>>
>>> ---
>>> libiberty/ChangeLog
>>>
>>> 2015-05-13 Iain Buclaw  <ibuclaw@gdcproject.org>
>>>
>>>       * d-demangle.c (dlang_call_convention): Return NULL if have reached
>>> the
>>>       end of the symbol, but expected more.
>>>       (dlang_attributes): Likewise.
>>>       (dlang_function_type): Likewise.
>>>       (dlang_type): Likewise.
>>>       (dlang_identifier): Likewise.
>>>       (dlang_value): Likewise.
>>
>> I spot checked various callers of these functions that not return NULL and
>> they looked reasonable. Though I was a bit concerned about the callers of
>> dlang_type, dlang_value and dlang_identifier.
>>
>> In those cases we'll often still do the string_append, string_setlength and
>> other calls in the caller of dlang_{value,type,identifier}.  I'm assuming
>> that's safe (the error still appears to be bubbling up properly).
>>
>
> The string routines should be safe for that (appending a string with a
> zero length does nothing, for instance).
>
>> If you can confirm that we're OK in those cases, then this is OK for the
>> trunk.
>>
>
> I can start fuzzing mangle strings to test that failures actually fail
> gracefully.  There's already a fuzzer that exists for C++, I think the
> only change that would be required for D is exchanging "_Z" for "_D"
> and calling cplus_demangle with DMGL_DLANG.
Your call whether to fuzz before or after committing the changes.

jeff

  reply	other threads:[~2015-05-14 14:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13  8:51 Iain Buclaw
2015-05-14 13:01 ` Jeff Law
2015-05-14 13:47   ` Iain Buclaw
2015-05-14 15:05     ` Jeff Law [this message]
2015-05-14 19:25       ` Iain Buclaw
2015-05-14 20:42         ` 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=5554B68A.1020900@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=iant@google.com \
    --cc=ibuclaw@gdcproject.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).