From: Jason Merrill <jason@redhat.com>
To: Nick Clifton <nickc@redhat.com>
Cc: Ian Lance Taylor <ian@airs.com>,
gcc-patches List <gcc-patches@gcc.gnu.org>,
redi@gcc.gnu.org
Subject: Re: RFA: libiberty: Add a limit on demangling qualifiers (PR 87241)
Date: Wed, 12 Dec 2018 20:31:00 -0000 [thread overview]
Message-ID: <CADzB+2mO3mLLZ31nU-oL5Kvf0vZjwZKu=LFAx1EfoVuA+s8cqg@mail.gmail.com> (raw)
In-Reply-To: <87pnu7j85i.fsf@redhat.com>
On Wed, Dec 12, 2018 at 6:29 AM Nick Clifton <nickc@redhat.com> wrote:
>
> Sorry to bother you, but I have another libiberty demangler resource
> exhaustion prevention patch to present. This one is for:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87241
>
> Jonathan Wakely reported that __cxa_demanlge() was returning a -2
> result, but I did not see this. Instead I found that
> consume_count_with_underscores() is returning a very large number
> (because a very large value is encoded in the mangled string) and this
> is resulting in many calls to remember_Ktype() which eventually
> exhaust the amount of memory available.
>
> The attached patch is a simplistic approach to solving this problem by
> adding a hard upper limit on the number of qualifiers that will be
> allowed by the demangler. I am not sure if this is the best approach
> to solving the problem, but it is a simple one, and I would think one
> that would not prevent the demangling of any real mangled names. The
> limit does not have to be DEMANGLE_RECURSE_LIMIT of course. I just
> chose that value because it was convenient and of a size that I
> thought was appropriate.
>
> I also did run the libiberty testsuite this time, with no failures
> reported. :-)
>
> OK to apply ?
>
> Cheers
> Nick
>
> libiberty/ChangeLog
> 2018-12-12 Nick Clifton <nickc@redhat.com>
>
> * cplus-dem.c (demangle_qualified): Add an upper limit on the
> number of qualifiers supported, based upon the value of
> DEMANGLE_RECURSE_LIMIT.
This issue also will be resolved by disabling or removing the old
demangling code, which I haven't seen anyone argue against.
Jason
next prev parent reply other threads:[~2018-12-12 20:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-12 11:29 Nick Clifton
2018-12-12 20:31 ` Jason Merrill [this message]
2018-12-13 9:48 ` Nick Clifton
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='CADzB+2mO3mLLZ31nU-oL5Kvf0vZjwZKu=LFAx1EfoVuA+s8cqg@mail.gmail.com' \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=ian@airs.com \
--cc=nickc@redhat.com \
--cc=redi@gcc.gnu.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).