Add null check for malformed code.

llvm-svn: 165733
This commit is contained in:
Ted Kremenek 2012-10-11 19:06:43 +00:00
parent 9f57186983
commit 241f1ef4cc
1 changed files with 5 additions and 2 deletions

View File

@ -510,8 +510,11 @@ void Sema::checkCall(NamedDecl *FDecl, Expr **Args,
// Refuse POD arguments that weren't caught by the format string
// checks above.
if (!HandledFormatString && CallType != VariadicDoesNotApply)
for (unsigned ArgIdx = NumProtoArgs; ArgIdx < NumArgs; ++ArgIdx)
variadicArgumentPODCheck(Args[ArgIdx], CallType);
for (unsigned ArgIdx = NumProtoArgs; ArgIdx < NumArgs; ++ArgIdx) {
// Args[ArgIdx] can be null in malformed code.
if (Expr *Arg = Args[ArgIdx])
variadicArgumentPODCheck(Arg, CallType);
}
for (specific_attr_iterator<NonNullAttr>
I = FDecl->specific_attr_begin<NonNullAttr>(),