Fixed #9347 (FP uninitvar for pointer passed to sscanf)

This commit is contained in:
Daniel Marjamäki 2019-10-17 17:41:54 +02:00
parent d1fce6b7ad
commit 15d7b9c83f
2 changed files with 4 additions and 1 deletions

View File

@ -5520,6 +5520,9 @@ static void valueFlowSubFunction(TokenList* tokenlist, ErrorLogger* errorLogger,
// Don't forward lifetime values
argvalues.remove_if(std::mem_fn(&ValueFlow::Value::isLifetimeValue));
// Don't forward <Uninit> values, this is handled by CTU. We also had a FP #9347
argvalues.remove_if(std::mem_fn(&ValueFlow::Value::isUninitValue));
if (argvalues.empty())
continue;

View File

@ -4278,7 +4278,7 @@ private:
" someType_t gVar;\n"
" bar(&gVar);\n"
"}\n");
ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:5]: (error) Uninitialized variable: flags\n", errout.str());
TODO_ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:5]: (error) Uninitialized variable: p->flags\n", "", errout.str());
valueFlowUninit("typedef struct \n"
"{\n"