Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/tokenlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1951,8 +1951,11 @@ void TokenList::validateAst(bool print) const
if (tok->str() == "?") {
if (!tok->astOperand1() || !tok->astOperand2())
throw InternalError(tok, "AST broken, ternary operator missing operand(s)", InternalError::AST);
if (tok->astOperand2()->str() != ":")
const Token* colon = tok->astOperand2();
if (colon->str() != ":")
throw InternalError(tok, "Syntax Error: AST broken, ternary operator lacks ':'.", InternalError::AST);
if ((colon->astOperand1() && !precedes(colon->astOperand1(), colon)) || !succeeds(colon->astOperand2(), colon))
throw InternalError(tok, "AST broken, ternary operator has bad operand(s)", InternalError::AST);
}

// Check for endless recursion
Expand Down
1 change: 1 addition & 0 deletions test/cli/fuzz-crash_c/14742
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
i(){b?8:{}!$}
Loading