summaryrefslogtreecommitdiff
path: root/test/asan/TestCases/Linux/bzero.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/asan/TestCases/Linux/bzero.cpp')
-rw-r--r--test/asan/TestCases/Linux/bzero.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/asan/TestCases/Linux/bzero.cpp b/test/asan/TestCases/Linux/bzero.cpp
new file mode 100644
index 000000000..430edb744
--- /dev/null
+++ b/test/asan/TestCases/Linux/bzero.cpp
@@ -0,0 +1,15 @@
+// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
+
+// REQUIRES: !android
+
+#include <assert.h>
+#include <strings.h>
+
+int main(int argc, char *argv[]) {
+ char buf[100];
+ // *& to suppress bzero-to-memset optimization.
+ (*&bzero)(buf, sizeof(buf) + 1);
+ // CHECK: AddressSanitizer: stack-buffer-overflow
+ // CHECK-NEXT: WRITE of size 101 at
+ return 0;
+}