This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA/RFC: Add stack recursion limit to libiberty's demangler
- From: Cary Coutant <ccoutant at gmail dot com>
- To: Nick Clifton <nickc at redhat dot com>, Jakub Jelinek <jakub at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Binutils <binutils at sourceware dot org>, sgayou at redhat dot com, Jason Merrill <jason at redhat dot com>, Michael Matz <matz at suse dot de>
- Date: Sat, 1 Dec 2018 16:49:31 -0800
- Subject: Re: RFA/RFC: Add stack recursion limit to libiberty's demangler
- References: <87muprdko7.fsf@redhat.com> <20181130084211.GX12380@tucnak> <173817ca-0aa0-e1a2-6725-37e079ead545@redhat.com> <alpine.LSU.2.21.1811301331360.5354@wotan.suse.de> <m35zwe4nqg.fsf@pepe.airs.com>
> That section is "Writing Robust Programs." Robustness guarantees have
> to be different for utilities and servers. A robust server doesn't
> crash because of arbitrary user input, but there are servers that
> demangle names that are provided by the user. So we need two modes for
> the demangler: one that takes anything and sometimes crashes, for
> utilities like c++filt, and one that doesn't crash, for servers. And it
> seems like that is what Nick is suggesting.
In order to handle arbitrary user input without crashing, perhaps the
demangler should switch from recursive descent parsing to a state
machine, where exhaustion of resources can be handled gracefully.
-cary