summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-01-30 01:12:44 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-01-30 01:12:44 +0000
commit4d365ba9b972b14a182976476fdbfb374721bd9c (patch)
tree224bf7a5854d66feb705357b4621817db07db51c /clang/lib/Sema/SemaChecking.cpp
parentc6c23753177128c6fc8f49730d21533a5f5bd644 (diff)
downloadbcm5719-llvm-4d365ba9b972b14a182976476fdbfb374721bd9c.tar.gz
bcm5719-llvm-4d365ba9b972b14a182976476fdbfb374721bd9c.zip
c: When checking on validity of sizeof passed as size of
argument to be memset, check for its type to be complete before calling Context.getTypeSize(PointeeTy) to prevent crash. // rdar://13081751. llvm-svn: 173872
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 9af16f3201e..465b01c9177 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -3253,7 +3253,8 @@ void Sema::CheckMemaccessArguments(const CallExpr *Call,
if (const UnaryOperator *UnaryOp = dyn_cast<UnaryOperator>(Dest))
if (UnaryOp->getOpcode() == UO_AddrOf)
ActionIdx = 1; // If its an address-of operator, just remove it.
- if (Context.getTypeSize(PointeeTy) == Context.getCharWidth())
+ if (!PointeeTy->isIncompleteType() &&
+ (Context.getTypeSize(PointeeTy) == Context.getCharWidth()))
ActionIdx = 2; // If the pointee's size is sizeof(char),
// suggest an explicit length.
OpenPOWER on IntegriCloud