From: Daniel Jasper Date: Mon, 23 Dec 2013 11:25:40 +0000 (+0000) Subject: clang-format: Fix invalid write discovered by ASAN. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a60f7122b55cc82d81d7dcc24d0e8e14ecb018b4;p=clang clang-format: Fix invalid write discovered by ASAN. Introduced in r197900. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197906 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/ContinuationIndenter.cpp b/lib/Format/ContinuationIndenter.cpp index 7b3f5cb67f..d4bf6ecfa9 100644 --- a/lib/Format/ContinuationIndenter.cpp +++ b/lib/Format/ContinuationIndenter.cpp @@ -421,7 +421,8 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State, // }]; // 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) {