Fixed #2411 (possible null pointer dereference (aborting via function pointer not detected))
This commit is contained in:
parent
033e759c39
commit
c74b2e3cbf
|
@ -553,7 +553,8 @@ void CheckNullPointer::nullPointerByCheckAndDeRef()
|
|||
|
||||
// calling unknown function (abort/init)..
|
||||
if (Token::simpleMatch(tok2, ") ;") &&
|
||||
Token::Match(tok2->link()->tokAt(-2), "[;{}] %var% ("))
|
||||
(Token::Match(tok2->link()->tokAt(-2), "[;{}] %var% (") ||
|
||||
Token::Match(tok2->link()->tokAt(-5), "[;{}] ( * %var% ) (")))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -754,6 +754,14 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void foo(char *p) {\n"
|
||||
" if (!p) {\n"
|
||||
" (*bail)();\n"
|
||||
" }\n"
|
||||
" *p = 0;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void foo(char *p) {\n"
|
||||
" if (!p) {\n"
|
||||
" throw x;\n"
|
||||
|
|
Loading…
Reference in New Issue