Null pointer dereference: sending to output stream
This commit is contained in:
parent
8716c771a4
commit
48f3921c36
|
@ -1316,7 +1316,7 @@ private:
|
|||
if (Token::simpleMatch(&tok, "* 0"))
|
||||
{
|
||||
if (Token::Match(tok.previous(), "[;{}=+-/(,]") ||
|
||||
Token::simpleMatch(tok.previous(), "return"))
|
||||
Token::Match(tok.previous(), "return|<<"))
|
||||
{
|
||||
CheckOther *checkOther = dynamic_cast<CheckOther *>(owner);
|
||||
if (checkOther)
|
||||
|
|
|
@ -957,6 +957,13 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (error) Possible null pointer dereference: abc\n", errout.str());
|
||||
|
||||
checkNullPointer("static void foo()\n"
|
||||
"{\n"
|
||||
" int *p(0);\n"
|
||||
" std::cout << *p;"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (error) Null pointer dereference\n", errout.str());
|
||||
|
||||
// no false positive..
|
||||
checkNullPointer("static void foo()\n"
|
||||
"{\n"
|
||||
|
|
Loading…
Reference in New Issue