From a32fb63443158bc07a8dc97a808e901f40eddeac Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Wed, 31 May 2023 20:56:12 +0200 Subject: [PATCH] Fix hang on huge array (followup to #11649) (#5094) * Fix hang on huge array * Fix another hang --- lib/valueflow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 51c995eef..103ddfe19 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -942,7 +942,7 @@ static void setTokenValue(Token* tok, if (Token::simpleMatch(parent, "-") && value2.bound == result.bound && value2.bound != ValueFlow::Value::Bound::Point) result.invertBound(); - setTokenValue(parent, result, settings); + setTokenValue(parent, result, settings, isInitList); } } } @@ -1363,7 +1363,7 @@ static void valueFlowNumber(TokenList *tokenlist, const Settings* settings) bool isInitList = false; const Token* endInit{}; for (Token *tok = tokenlist->front(); tok;) { - if (!isInitList && tok->str() == "{" && Token::simpleMatch(tok->astOperand1(), ",")) { + if (!isInitList && tok->str() == "{" && (Token::simpleMatch(tok->astOperand1(), ",") || Token::simpleMatch(tok->astOperand2(), ","))) { isInitList = true; endInit = tok->link(); }