This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Set DEMANGLE_RECURSION_LIMIT to 1536
- From: David Malcolm <dmalcolm at redhat dot com>
- To: Michael Matz <matz at suse dot de>, Nick Clifton <nickc at redhat dot com>
- Cc: Ian Lance Taylor <iant at google dot com>, "H.J. Lu" <hjl dot tools at gmail dot com>, Pedro Alves <palves at redhat dot com>, Richard Guenther <richard dot guenther at gmail dot com>, Jakub Jelinek <jakub at redhat dot com>, sgayou at redhat dot com, Tom Tromey <tom at tromey dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Binutils <binutils at sourceware dot org>, Jason Merrill <jason at redhat dot com>
- Date: Mon, 10 Dec 2018 10:18:05 -0500
- Subject: Re: [PATCH] Set DEMANGLE_RECURSION_LIMIT to 1536
- References: <email@example.com> <20181130084211.GX12380@tucnak> <firstname.lastname@example.org> <email@example.com> <20181130140330.GA12380@tucnak> <firstname.lastname@example.org> <CAFiYyc1gTSXgSiJSFKEWaE0UTGbi45-mWHKJnUb4Wvjp86bbFQ@mail.gmail.com> <email@example.com> <CAKOQZ8zspME4gzoRw4xgFcShoqeUfp_e=Og=4S-yKn4EehokeA@mail.gmail.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <CAKOQZ8y=B6beozokJ2tdAAkVDVue08ogehMP7TAXvrPzdz9MuQ@mail.gmail.com> <CAMe9rOomd2E3C03CxTXyTRkq6HG32OX+rbMPS3y6dcEWmwaMYg@mail.gmail.com> <CAMe9rOokMpaAUFk0rcYTTUQTQhEMn-VQetXfiDTDXYdTXZEJTA@mail.gmail.com> <alpine.LSU.email@example.com>
On Mon, 2018-12-10 at 14:52 +0000, Michael Matz wrote:
> On Fri, 7 Dec 2018, H.J. Lu wrote:
> > > > On Thu, Dec 6, 2018 at 3:12 AM Nick Clifton <firstname.lastname@example.org>
> > > > wrote:
> > > > >
> > > > > Is the patch OK with you ?
> > >
> > > This caused:
> > >
> > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88409
> > >
> > Here is the fix. OK for trunk?
> I think this points toward the limit being _much_ too low. With
> meta programming you easily get these mangled names, it's not even a
> particularly long one. But I'm wondering a bit, without tracing the
> demangler, just looking at the symbol name and demangled result I
> readily see where the depth of recursion really is more than 1024,
> there perhaps some recursion_level-- statements skipped?
Apologies in advance if this has been covered, as I've only been half-
watching this thread, but is it always the case that the recursion
depth can be bounded by some scalar multiple of the number of
characters in the name?
The name that's causing trouble is 654 characters long, and the
proposed limit of 1306 is slightly below double that. There may well
be a bug in the implementation as Michael points out, but is the
recursion depth always guaranteed to be less than 2 * num_chars seen,
or somesuch limit. If so, could the limit be dynamic, rather than
hardcoded? That would trap cases where we're consuming stack frames
without consuming input characters, and eliminate having a hardcoded
limit that's bound to eventually become wrong as people write more and
more complicated C++ programs.
Hope this is constructive