summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2019-01-23 03:37:29 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2019-01-23 03:37:29 +0000
commitcfa79b27b5c50c0f698176355b9f3249036c267e (patch)
tree70777ab9e9edf970619c545490fef61ef0778c0d /clang/lib/CodeGen/CodeGenFunction.h
parent59d99731467654bd488d54eaa44855c5b5a0d8c0 (diff)
downloadbcm5719-llvm-cfa79b27b5c50c0f698176355b9f3249036c267e.tar.gz
bcm5719-llvm-cfa79b27b5c50c0f698176355b9f3249036c267e.zip
[ubsan] Check the correct size when sanitizing array new.
We previously forgot to multiply the element size by the array bound. llvm-svn: 351924
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index 792caa9c089..90c99e09fc1 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -2620,10 +2620,12 @@ public:
bool sanitizePerformTypeCheck() const;
/// Emit a check that \p V is the address of storage of the
- /// appropriate size and alignment for an object of type \p Type.
+ /// appropriate size and alignment for an object of type \p Type
+ /// (or if ArraySize is provided, for an array of that bound).
void EmitTypeCheck(TypeCheckKind TCK, SourceLocation Loc, llvm::Value *V,
QualType Type, CharUnits Alignment = CharUnits::Zero(),
- SanitizerSet SkippedChecks = SanitizerSet());
+ SanitizerSet SkippedChecks = SanitizerSet(),
+ llvm::Value *ArraySize = nullptr);
/// Emit a check that \p Base points into an array object, which
/// we can access at index \p Index. \p Accessed should be \c false if we
OpenPOWER on IntegriCloud