BalancedDelimiterTracker::diagnoseOverflow calls P.SkipUntil which is
itself recursive. This can cause a stack overflow on systems that have
a limited stack. For example, on OS X with a debug build I get:

$ (ulimit -s 1000; ./bin/clang -cc1
~/llvm/clang/test/Parser/parser_overflow.c  -DHUGE > /dev/null 2>&1;
echo $?)
139

(ulimit -s 10000; ./bin/clang -cc1
~/llvm/clang/test/Parser/parser_overflow.c  -DHUGE > /dev/null 2>&1;
echo $?)
1

The attached patch fixes the problem by just special casing "skip to
the end of the file" to not try to balance tokens.

I found this while testing pipefail on windows, so it would get an
automatic test once we switch. check-all is clean, Is the patch ok?

Cheers,
Rafael

Attachment: t.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to