Hi Cary, > 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.
I think that that would be a better long term fix for the problem, but it is not one that I have time to work on right now. My main goal with this patch submission is to stop the flood of PR and CVEs about mangled inputs that trigger stack exhaustion. Being able to properly demangle such inputs would be nice, but not something that I think should be a priority. I think that in real life no program is ever going to generate a mangled name that is sufficiently complex to trigger a seg-fault this way, so the only real purpose of the patch is to resolve these PRs and stop more from being filed. Cheers Nick