From 1e8938da86d816f96742dd651e39820b63ed9219 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 5 May 2026 09:50:08 +0200 Subject: [PATCH 1/2] Update valueflow.cpp --- lib/valueflow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index e22a93845a8..3819bfc4b41 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -6221,6 +6221,8 @@ bool ValueFlow::isContainerSizeChanged(const Token* tok, int indirect, const Set return true; if (astIsLHS(tok) && Token::simpleMatch(tok->astParent(), "[")) return tok->valueType()->container->stdAssociativeLike; + if (Token::simpleMatch(tok->astParent(), "*") && indirect > 0) + return isContainerSizeChanged(tok->astParent(), indirect - 1, settings, depth + 1); const Library::Container::Action action = astContainerAction(tok, settings.library); switch (action) { case Library::Container::Action::RESIZE: From f4eb08b286502dd00a3ed156894afa7cb5df7bf2 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 5 May 2026 09:52:05 +0200 Subject: [PATCH 2/2] Update testvalueflow.cpp --- test/testvalueflow.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index ff5d18b3175..51bb78aa40a 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -7486,6 +7486,16 @@ class TestValueFlow : public TestFixture { " if (s.empty()) {}\n" "}"; ASSERT(!isKnownContainerSizeValue(tokenValues(code, "s ."), 0).empty()); + + code = "void g(std::map* p) {\n" // #14721 + " (*p)[1] = 2;\n" + "}\n" + "void f() {\n" + " std::map m;\n" + " g(&m);\n" + " if (m.empty()) {}\n" + "}\n"; + ASSERT(!isKnownContainerSizeValue(tokenValues(code, "m ."), 0).empty()); } void valueFlowContainerElement()