diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-04-28 01:38:02 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-04-28 01:38:02 +0000 |
commit | 1d59f7f8fb39fa44ddbb6e2abd321af863b1f55b (patch) | |
tree | f3c96574a963e1c1370f4b9df268a836b3c5e38a /lib/Sema/SemaChecking.cpp | |
parent | 0931797d68b42c0390bb57f5e5ac265ddbda4b81 (diff) |
Convert assertion in memset checking to a runtime check (because real code may provide a deviant definition of memset).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130368 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 7ee0eac370..f616a10524 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -1804,7 +1804,12 @@ void Sema::CheckFormatString(const StringLiteral *FExpr, /// /// \param Call The call expression to diagnose. void Sema::CheckMemsetArguments(const CallExpr *Call) { - assert(Call->getNumArgs() == 3 && "Unexpected number of arguments to memset"); + // It is possible to have a non-standard definition of memset. Validate + // we have the proper number of arguments, and if not, abort further + // checking. + if (Call->getNumArgs() != 3) + return; + const Expr *Dest = Call->getArg(0)->IgnoreParenImpCasts(); QualType DestTy = Dest->getType(); |