Uninitialized variables; avoid false positives when passing uninitialized variable to unknown function
This commit is contained in:
parent
a2e709a652
commit
fa72ec20b2
|
@ -1511,6 +1511,8 @@ void CheckUninitVar::valueFlowUninit()
|
|||
continue;
|
||||
if (v->indirect > 1 || v->indirect < 0)
|
||||
continue;
|
||||
if (v->indirect == 0 && tok->valueType() && tok->valueType()->pointer == 0 && !isVariableUsage(tok, false, NO_ALLOC, 0))
|
||||
continue;
|
||||
bool uninitderef = false;
|
||||
if (tok->variable()) {
|
||||
bool unknown;
|
||||
|
|
|
@ -4601,6 +4601,12 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
valueFlowUninit("void json_parse_nat_type_flags(json_t *root) {\n"
|
||||
" int index;\n"
|
||||
" json_array_foreach(root, index, value) {}\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
valueFlowUninit("int foo()\n"
|
||||
"{\n"
|
||||
" int i;\n"
|
||||
|
|
Loading…
Reference in New Issue