r197906 - clang-format: Fix invalid write discovered by ASAN.
Daniel Jasper
djasper at google.com
Mon Dec 23 03:25:41 PST 2013
Author: djasper
Date: Mon Dec 23 05:25:40 2013
New Revision: 197906
URL: http://llvm.org/viewvc/llvm-project?rev=197906&view=rev
Log:
clang-format: Fix invalid write discovered by ASAN.
Introduced in r197900.
Modified:
cfe/trunk/lib/Format/ContinuationIndenter.cpp
Modified: cfe/trunk/lib/Format/ContinuationIndenter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/ContinuationIndenter.cpp?rev=197906&r1=197905&r2=197906&view=diff
==============================================================================
--- cfe/trunk/lib/Format/ContinuationIndenter.cpp (original)
+++ cfe/trunk/lib/Format/ContinuationIndenter.cpp Mon Dec 23 05:25:40 2013
@@ -421,7 +421,8 @@ unsigned ContinuationIndenter::addTokenO
// }];
// Thus, we set LastSpace of the next higher ParenLevel, to which we move
// when we consume all of the "}"'s FakeRParens at the "{".
- State.Stack[State.Stack.size() - 2].LastSpace = ContinuationIndent;
+ if (State.Stack.size() > 1)
+ State.Stack[State.Stack.size() - 2].LastSpace = ContinuationIndent;
} else if (Current.Type == TT_CtorInitializerColon) {
State.Column = State.FirstIndent + Style.ConstructorInitializerIndentWidth;
} else if (Current.Type == TT_CtorInitializerComma) {
More information about the cfe-commits
mailing list