Fix issue 9348: FP uninitvar for pointer passed to memcpy (#2167)
This commit is contained in:
parent
ddb1f1b5ce
commit
2595b82634
|
@ -1051,7 +1051,7 @@ bool isVariableChangedByFunctionCall(const Token *tok, int indirect, const Setti
|
|||
argDirection == Library::ArgumentChecks::Direction::DIR_INOUT) {
|
||||
// With out or inout the direction of the content is specified, not a pointer itself, so ignore pointers for now
|
||||
const ValueType * const valueType = tok1->valueType();
|
||||
if (valueType && !valueType->pointer) {
|
||||
if (valueType && valueType->pointer == indirect) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4448,6 +4448,17 @@ private:
|
|||
" return;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// # 9348
|
||||
valueFlowUninit("void f(int *a) {\n"
|
||||
" int b = 0;\n"
|
||||
" memcpy(a, &b, sizeof(b));\n"
|
||||
"}\n"
|
||||
"void g() {\n"
|
||||
" int i;\n"
|
||||
" f(&i);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void uninitvar_memberfunction() {
|
||||
|
|
Loading…
Reference in New Issue