Skip to content

Commit 5aa31d0

Browse files
Fix #14452 fuzzing crash (null-pointer-use) in ReverseTraversal::traverse() (#8723)
1 parent 3deb36d commit 5aa31d0

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

lib/tokenlist.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1947,6 +1947,9 @@ void TokenList::validateAst(bool print) const
19471947
if ((tok->isAssignmentOp() || tok->isComparisonOp() || Token::Match(tok,"[|^/%]")) && tok->astOperand1() && !tok->astOperand2())
19481948
throw InternalError(tok, "Syntax Error: AST broken, binary operator has only one operand.", InternalError::AST);
19491949

1950+
if (!(tok->astOperand1() && tok->astOperand2()) && ((isC() && tok->str() == "&&") || Token::Match(tok, "%or%|%oror%")))
1951+
throw InternalError(tok, "Syntax Error: AST broken, binary operator is missing operand(s).", InternalError::AST);
1952+
19501953
// Syntax error if we encounter "?" with operand2 that is not ":"
19511954
if (tok->str() == "?") {
19521955
if (!tok->astOperand1() || !tok->astOperand2())
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
n(f=n){n&&,n}

0 commit comments

Comments
 (0)