diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-10-11 19:06:43 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-10-11 19:06:43 +0000 |
commit | 0234bfa2b03470b8ce379a7485e60ffa35c1d550 (patch) | |
tree | 06273ee8ca031859959b9ac5969c9906894b5437 /lib/Sema/SemaChecking.cpp | |
parent | 8003fd613724847bba834ae41aca6f446af1f818 (diff) |
Add null check for malformed code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165733 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 480088619c..6a39ff003c 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -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>(), |