[cfe-commits] [PATCH] Implementation quantity limits to prevent crashes

Eli Friedman eli.friedman at gmail.com
Wed Sep 21 18:11:55 PDT 2011


On Tue, Sep 20, 2011 at 12:26 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
> This fixes Bug 10332 where nested braces causes the parser to crash
> with a stack overflow.  It also fixes the same issue with parens for
> expressions.  It's a more generalized fix that can be applied for most
> of the quantities listed in [implimits] should it be desired.

I would really like to see some sort of systematic approach here, so
we don't miss any cases...

> One thing which I'd like to direct special attention to is how I'm
> "handling" the fatal error in Parser::ImplQuantityTracker::report.
> I'm uncertain of what place to skip to due to the nature of the issue.
>  At the point of failure, we've read a lot of { or ( and are "too
> deep."  Skipping until we find a } doesn't seem like it would produce
> a likely recovery point.  However, I'm more than happy to take
> suggestions on improvements for it as skipping to EOF doesn't feel
> quite right either.

The error is DefaultFatal; how could it possibly make a difference?

> Also, the diagnostic wording was taken from MSVC, but could likely be
> improved.  Suggestions welcome.

I would say something more along the lines of "parser recusion limit
reached"; using the term "stack overflow" makes it sound like a bug in
the compiler.

-Eli




More information about the cfe-commits mailing list