From b246781da6bb90a1061d296e1b7b0c846379bb4c Mon Sep 17 00:00:00 2001 From: Jens Yllman Date: Sat, 9 Jul 2022 00:57:44 +0200 Subject: [PATCH] Try to stop range overflow in forwardRange() (#4235) * Try to stop range overflow in forwardRange() * Use predefinded function for check instead --- lib/pathanalysis.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pathanalysis.cpp b/lib/pathanalysis.cpp index f70681372..85431f4f4 100644 --- a/lib/pathanalysis.cpp +++ b/lib/pathanalysis.cpp @@ -85,7 +85,7 @@ PathAnalysis::Progress PathAnalysis::forwardRecursive(const Token* tok, Info inf PathAnalysis::Progress PathAnalysis::forwardRange(const Token* startToken, const Token* endToken, Info info, const std::function& f) const { - for (const Token *tok = startToken; tok && tok != endToken; tok = tok->next()) { + for (const Token *tok = startToken; precedes(tok, endToken); tok = tok->next()) { if (Token::Match(tok, "asm|goto|break|continue")) return Progress::Break; else if (Token::Match(tok, "return|throw")) {