Skip to content

Commit

Permalink
[clang-format] Fix crash in getLengthToMatchingParen
Browse files Browse the repository at this point in the history
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
  • Loading branch information
krasimirgg committed May 22, 2018
1 parent 11d68a6 commit f163bdc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions clang/lib/Format/ContinuationIndenter.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit f163bdc

Please sign in to comment.