diff options
author | Krasimir Georgiev <krasimir@google.com> | 2018-05-22 09:46:55 +0000 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2018-05-22 09:46:55 +0000 |
commit | f163bdc07ee357753f36ecb922acd769f0df6c98 (patch) | |
tree | 4566d7b731e760948d0630f5d0a44617be0a6ef9 /clang | |
parent | 11d68a619e3f1f1ea5d42441ae4145ae378d6f32 (diff) | |
download | bcm5719-llvm-f163bdc07ee357753f36ecb922acd769f0df6c98.tar.gz bcm5719-llvm-f163bdc07ee357753f36ecb922acd769f0df6c98.zip |
[clang-format] Fix crash in getLengthToMatchingParen
Summary:
Found by oss-fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8212
Reviewers: bkramer
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D47191
llvm-svn: 332961
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index fc4c9115e89..fe6a9568396 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -94,9 +94,9 @@ static unsigned getLengthToMatchingParen(const FormatToken &Tok, break; if (!End->Next->closesScope()) continue; - if (End->Next->MatchingParen->isOneOf(tok::l_brace, - TT_ArrayInitializerLSquare, - tok::less)) { + if (End->Next->MatchingParen && + End->Next->MatchingParen->isOneOf( + tok::l_brace, TT_ArrayInitializerLSquare, tok::less)) { const ParenState *State = FindParenState(End->Next->MatchingParen); if (State && State->BreakBeforeClosingBrace) break; |