From fa6a550b4198065f1d4226e3c9fef4ca32330735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludvig=20Gunne=20Lindstr=C3=B6m?= Date: Fri, 21 Aug 2026 10:51:16 +0200 Subject: [PATCH 1/3] test --- test/testvalueflow.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 39916ddeb43..83b861a697c 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -7939,6 +7939,17 @@ class TestValueFlow : public TestFixture { " (void) x;\n" "}\n"; ASSERT_EQUALS(true, testValueOfX(code, 4U, 0, ValueFlow::Value::ValueType::BUFFER_SIZE)); + + code = "void f(int *x)\n" + "{\n" + " *x = 1;\n" + "}\n" + "void g(void)\n" + "{\n" + " int *ptr = malloc(1234);\n" + " f(ptr);\n" + "}\n"; + ASSERT_EQUALS(true, testValueOfX(code, 3U, 1234, ValueFlow::Value::ValueType::BUFFER_SIZE)); } void valueFlowSafeFunctionParameterValues() { From a6a5c18f61eb1fecb4e2329bdd4cdbb04406264f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludvig=20Gunne=20Lindstr=C3=B6m?= Date: Fri, 21 Aug 2026 10:47:36 +0200 Subject: [PATCH 2/3] fix --- lib/valueflow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 7acf7179723..3234f71fe5f 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -7541,6 +7541,7 @@ void ValueFlow::setValues(TokenList& tokenlist, VFA(valueFlowInferCondition(tokenlist, settings)), VFA(valueFlowSwitchVariable(tokenlist, symboldatabase, errorLogger, settings)), VFA(valueFlowForLoop(tokenlist, symboldatabase, errorLogger, settings)), + VFA(valueFlowDynamicBufferSize(tokenlist, symboldatabase, errorLogger, settings)), VFA(valueFlowSubFunction(tokenlist, symboldatabase, errorLogger, settings)), VFA(valueFlowFunctionReturn(tokenlist, errorLogger, settings)), VFA(valueFlowLifetime(tokenlist, errorLogger, settings)), @@ -7557,7 +7558,6 @@ void ValueFlow::setValues(TokenList& tokenlist, }); runner.run_once({ - VFA(valueFlowDynamicBufferSize(tokenlist, symboldatabase, errorLogger, settings)), VFA(valueFlowDebug(tokenlist, errorLogger, settings)), // TODO: add option to print it after each step/iteration }); } From 531bc06a8858e5b01fd0584b96258774f38aef99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludvig=20Gunne=20Lindstr=C3=B6m?= Date: Fri, 21 Aug 2026 11:12:54 +0200 Subject: [PATCH 3/3] update cli test --- test/cli/other_test.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/cli/other_test.py b/test/cli/other_test.py index f5928c07de5..4d4dbec7b0a 100644 --- a/test/cli/other_test.py +++ b/test/cli/other_test.py @@ -210,6 +210,8 @@ def test_progress(tmpdir): "progress: ValueFlow::valueFlowSwitchVariable(tokenlist, symboldatabase, errorLogger, settings) 1 100%\n" "progress: ValueFlow::valueFlowForLoop(tokenlist, symboldatabase, errorLogger, settings) 1 0%\n" "progress: ValueFlow::valueFlowForLoop(tokenlist, symboldatabase, errorLogger, settings) 1 100%\n" + "progress: ValueFlow::valueFlowDynamicBufferSize(tokenlist, symboldatabase, errorLogger, settings) 1 0%\n" + "progress: ValueFlow::valueFlowDynamicBufferSize(tokenlist, symboldatabase, errorLogger, settings) 1 100%\n" "progress: ValueFlow::valueFlowSubFunction(tokenlist, symboldatabase, errorLogger, settings) 1 0%\n" "progress: ValueFlow::valueFlowSubFunction(tokenlist, symboldatabase, errorLogger, settings) 1 100%\n" "progress: ValueFlow::valueFlowFunctionReturn(tokenlist, errorLogger, settings) 1 0%\n"