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

Aaron Ballman aaron at aaronballman.com
Tue Sep 20 12:26:17 PDT 2011


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.

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.

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

The patch includes a test case from the bug report.

~Aaron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ParserLimits.diff
Type: application/octet-stream
Size: 38008 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110920/cf7eb011/attachment.obj>


More information about the cfe-commits mailing list