While fuzzing a language made with antlr, the fuzzer reported a slow testcase that was using quite a lot of parens.
One of the rules in the grammar is somewhat like:
paren_expression: '(' expression ')';
Even if it was reported as a slow unit, it underlies the bigger problem of being able to somewhat easily crash the application with enough parens used (and it does on windows which has smaller stack size by default).
From what I searched, there's no option to generate code that checks the stack depth and exits after a reasonable depth, and recovering from stack overflow in C++ is not really a good or portable thing to do.
So, what can be done in this case? Crashing from bad input is not very nice.