owenpan updated this revision to Diff 434773.
owenpan added a comment.

Inadvertently moved the added code down when rebasing. Fixed.


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
@@ -842,6 +842,10 @@
   unsigned InitialLevel = Line->Level;
   nextToken(/*LevelDifference=*/AddLevels);
 
+  // Bail out if there are too many levels. Otherwise, the stack might 
overflow.
+  if (Line->Level > 300)
+    return;
+
   if (MacroBlock && FormatTok->is(tok::l_paren))
     parseParens();
 


Index: clang/lib/Format/UnwrappedLineParser.cpp
===================================================================
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -842,6 +842,10 @@
   unsigned InitialLevel = Line->Level;
   nextToken(/*LevelDifference=*/AddLevels);
 
+  // Bail out if there are too many levels. Otherwise, the stack might overflow.
+  if (Line->Level > 300)
+    return;
+
   if (MacroBlock && FormatTok->is(tok::l_paren))
     parseParens();
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to