Home | History | Annotate | Download | only in Linux
      1 // Test that preloaded runtime works with unsanitized executables.
      2 //
      3 // RUN: %clangxx %s -o %t
      4 // RUN: LD_PRELOAD=%shared_libasan not %run %t 2>&1 | FileCheck %s
      5 
      6 // REQUIRES: asan-dynamic-runtime
      7 // XFAIL: android
      8 
      9 #include <stdlib.h>
     10 
     11 extern "C" void *memset(void *p, int val, size_t n);
     12 
     13 void do_access(void *p) {
     14   // CHECK: AddressSanitizer: heap-buffer-overflow
     15   memset(p, 0, 2);
     16 }
     17 
     18 int main(int argc, char **argv) {
     19   void *p = malloc(1);
     20   do_access(p);
     21   return 0;
     22 }
     23