1 // RUN: %clangxx_asan -O0 %p/dll_host.cc -Fe%t
2 // RUN: %clangxx_asan -LD -O0 %s -Fe%t.dll
3 // FIXME: 'cat' is needed due to PR19744.
4 // RUN: not %run %t %t.dll 2>&1 | cat | FileCheck %s
9 void call_memcpy(void* (*f
)(void *, const void *, size_t),
10 void *a
, const void *b
, size_t c
) {
14 extern "C" __declspec(dllexport
)
16 char buff1
[6] = "Hello", buff2
[5];
18 call_memcpy(&memcpy
, buff2
, buff1
, 5);
19 if (buff1
[2] != buff2
[2])
21 printf("Initial test OK\n");
23 // CHECK: Initial test OK
25 call_memcpy(&memcpy
, buff2
, buff1
, 6);
26 // CHECK: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]
27 // CHECK: WRITE of size 6 at [[ADDR]] thread T0
28 // CHECK-NEXT: __asan_memcpy
29 // CHECK-NEXT: call_memcpy
30 // CHECK-NEXT: test_function {{.*}}dll_intercept_memcpy.cc:[[@LINE-5]]
31 // CHECK: Address [[ADDR]] is located in stack of thread T0 at offset {{.*}} in frame
32 // CHECK-NEXT: test_function {{.*}}dll_intercept_memcpy.cc
33 // CHECK: 'buff2' <== Memory access at offset {{.*}} overflows this variable