[compiler-rt] r347107 - [hwasan] use reads instead of writes in a test

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 16 15:01:42 PST 2018


Author: kcc
Date: Fri Nov 16 15:01:42 2018
New Revision: 347107

URL: http://llvm.org/viewvc/llvm-project?rev=347107&view=rev
Log:
[hwasan] use reads instead of writes in a test

Modified:
    compiler-rt/trunk/test/hwasan/TestCases/heap-buffer-overflow.c

Modified: compiler-rt/trunk/test/hwasan/TestCases/heap-buffer-overflow.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/heap-buffer-overflow.c?rev=347107&r1=347106&r2=347107&view=diff
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/heap-buffer-overflow.c (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/heap-buffer-overflow.c Fri Nov 16 15:01:42 2018
@@ -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




More information about the llvm-commits mailing list