Fix 10619: Valueflow: Library function in subfunction does not propagate all values (#4209)

This commit is contained in:
Paul Fultz II 2022-06-12 00:17:28 -05:00 committed by GitHub
parent bd63534a1c
commit d4fb5652c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -6820,6 +6820,8 @@ bool productParams(const std::unordered_map<Key, std::list<ValueFlow::Value>>& v
for (auto arg:args) {
if (value.path != 0) {
for (const auto& q:arg) {
if (q.first == p.first)
continue;
if (q.second.path == 0)
continue;
if (q.second.path != value.path)

View File

@ -4398,6 +4398,17 @@ private:
"}\n";
ASSERT_EQUALS(true, testValueOfX(code, 7U, 0));
ASSERT_EQUALS(false, testValueOfXKnown(code, 7U, 0));
code = "int f(int i) {\n"
" int x = abs(i);\n"
" return x;\n"
"}\n"
"void g() {\n"
" f(1);\n"
" f(0);\n"
"}\n";
ASSERT_EQUALS(true, testValueOfX(code, 3U, 1));
ASSERT_EQUALS(true, testValueOfX(code, 3U, 0));
}
void valueFlowFunctionReturn() {
const char *code;