forked from OSchip/llvm-project
[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
This commit is contained in:
parent
11d68a619e
commit
f163bdc07e
|
@ -94,9 +94,9 @@ static unsigned getLengthToMatchingParen(const FormatToken &Tok,
|
||||||
break;
|
break;
|
||||||
if (!End->Next->closesScope())
|
if (!End->Next->closesScope())
|
||||||
continue;
|
continue;
|
||||||
if (End->Next->MatchingParen->isOneOf(tok::l_brace,
|
if (End->Next->MatchingParen &&
|
||||||
TT_ArrayInitializerLSquare,
|
End->Next->MatchingParen->isOneOf(
|
||||||
tok::less)) {
|
tok::l_brace, TT_ArrayInitializerLSquare, tok::less)) {
|
||||||
const ParenState *State = FindParenState(End->Next->MatchingParen);
|
const ParenState *State = FindParenState(End->Next->MatchingParen);
|
||||||
if (State && State->BreakBeforeClosingBrace)
|
if (State && State->BreakBeforeClosingBrace)
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue