This is the mail archive of the
mailing list for the binutils 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: <email@example.com> <20181130084211.GX12380@tucnak> <firstname.lastname@example.org> <alpine.LSU.email@example.com> <firstname.lastname@example.org>
> 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.