1// RUN: %clang_cl_asan -O0 %p/dll_host.cc -Fe%t 2// RUN: %clang_cl_asan -LD -O0 %s -Fe%t.dll 3// RUN: not %run %t %t.dll 2>&1 | FileCheck %s 4 5#include <string.h> 6 7extern "C" __declspec(dllexport) 8int test_function() { 9 char buff[6] = "Hello"; 10 11 memchr(buff, 'z', 7); 12// CHECK: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] 13// CHECK: READ of size 7 at [[ADDR]] thread T0 14// CHECK-NEXT: __asan_wrap_memchr 15// CHECK-NEXT: memchr 16// CHECK-NEXT: test_function {{.*}}dll_intercept_memchr.cc:[[@LINE-5]] 17// CHECK: Address [[ADDR]] is located in stack of thread T0 at offset {{.*}} in frame 18// CHECK-NEXT: test_function {{.*}}dll_intercept_memchr.cc 19// CHECK: 'buff' <== Memory access at offset {{.*}} overflows this variable 20 return 0; 21} 22