diff options
author | Kostya Serebryany <kcc@google.com> | 2018-11-16 23:01:42 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2018-11-16 23:01:42 +0000 |
commit | 31b6a14a99ed1b68f2fa08d8e64e3ab5b9c35f07 (patch) | |
tree | 6e7e78eff62d2db8a6de1ea341595e4b8017c54c | |
parent | 003b720873f408e87c072eec1144a9b481d25028 (diff) | |
download | bcm5719-llvm-31b6a14a99ed1b68f2fa08d8e64e3ab5b9c35f07.tar.gz bcm5719-llvm-31b6a14a99ed1b68f2fa08d8e64e3ab5b9c35f07.zip |
[hwasan] use reads instead of writes in a test
llvm-svn: 347107
-rw-r--r-- | compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c b/compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c index 854a26ba9ba..e356d53625d 100644 --- a/compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c +++ b/compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c @@ -23,13 +23,15 @@ #include <stdio.h> #include <sanitizer/hwasan_interface.h> +static volatile char sink; + int main(int argc, char **argv) { __hwasan_enable_allocator_tagging(); int offset = argc < 2 ? 40 : atoi(argv[1]); int size = argc < 3 ? 30 : atoi(argv[2]); char * volatile x = (char*)malloc(size); fprintf(stderr, "base: %p access: %p\n", x, &x[offset]); - x[offset] = 42; + sink = x[offset]; // CHECK40-LEFT: allocated heap chunk; size: 32 offset: 8 // CHECK40-LEFT: is located 10 bytes to the right of 30-byte region |