owenpan updated this revision to Diff 434761.
owenpan edited the summary of this revision.
owenpan added a comment.
Rebased.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127183/new/
https://reviews.llvm.org/D127183
Files:
clang/lib/Format/UnwrappedLineParser.cpp
Index: clang/lib/Format/UnwrappedLineParser.cpp
===================================================================
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -864,6 +864,10 @@
if (AddLevels > 0u && Style.BreakBeforeBraces != FormatStyle::BS_Whitesmiths)
Line->Level += AddLevels;
+ // Bail out if there are too many levels. Otherwise, the stack might
overflow.
+ if (Line->Level > 300)
+ return;
+
const bool SimpleBlock =
parseLevel(Tok, CanContainBracedList, NextLBracesType, IfKind);
Index: clang/lib/Format/UnwrappedLineParser.cpp
===================================================================
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -864,6 +864,10 @@
if (AddLevels > 0u && Style.BreakBeforeBraces != FormatStyle::BS_Whitesmiths)
Line->Level += AddLevels;
+ // Bail out if there are too many levels. Otherwise, the stack might overflow.
+ if (Line->Level > 300)
+ return;
+
const bool SimpleBlock =
parseLevel(Tok, CanContainBracedList, NextLBracesType, IfKind);
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits