Fixed #2753 (False negative: dereference uninitialized pointer 'buf[0] = 0;')
This commit is contained in:
parent
6d858b63a1
commit
e22f69daf4
|
@ -507,6 +507,11 @@ private:
|
|||
const Token *tok2 = tok.next();
|
||||
if (tok2->str() == "[" && Token::simpleMatch(tok2->link(), "] ="))
|
||||
{
|
||||
if (use_dead_pointer(checks, &tok))
|
||||
{
|
||||
return &tok;
|
||||
}
|
||||
|
||||
parserhs(tok2, checks);
|
||||
tok2 = tok2->link()->next();
|
||||
}
|
||||
|
|
|
@ -127,6 +127,13 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: p\n", errout.str());
|
||||
|
||||
checkUninitVar("static void foo()\n"
|
||||
"{\n"
|
||||
" int *p;\n"
|
||||
" p[0] = 135;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (error) Uninitialized variable: p\n", errout.str());
|
||||
|
||||
checkUninitVar("static void foo()\n"
|
||||
"{\n"
|
||||
" int *x;\n"
|
||||
|
|
Loading…
Reference in New Issue