Fix a crash in MallocOverflowSecurityChecker. Patch by Lei Zhang.

llvm-svn: 140648
This commit is contained in:
Anna Zaks 2011-09-27 22:25:01 +00:00
parent c63af1b7b6
commit 0070c6d4db
2 changed files with 13 additions and 0 deletions

View File

@ -244,6 +244,8 @@ void MallocOverflowSecurityChecker::checkASTCodeBody(const Decl *D,
// Get the name of the callee. If it's a builtin, strip off the prefix.
IdentifierInfo *FnInfo = FD->getIdentifier();
if (!FnInfo)
return;
if (FnInfo->isStr ("malloc") || FnInfo->isStr ("_MALLOC")) {
if (TheCall->getNumArgs() == 1)

View File

@ -0,0 +1,11 @@
// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.security.MallocOverflow -verify %s
class A {
public:
A& operator<<(const A &a);
};
void f() {
A a = A(), b = A();
a << b;
}