Author: krasimir Date: Tue May 22 02:46:55 2018 New Revision: 332961 URL: http://llvm.org/viewvc/llvm-project?rev=332961&view=rev Log: [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 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=332961&r1=332960&r2=332961&view=diff ============================================================================== --- cfe/trunk/lib/Format/ContinuationIndenter.cpp (original) +++ cfe/trunk/lib/Format/ContinuationIndenter.cpp Tue May 22 02:46:55 2018 @@ -94,9 +94,9 @@ static unsigned getLengthToMatchingParen 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; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits