1 // RUN: %clang_cl_asan %Od %p/dll_host.cpp %Fe%t
2 // RUN: %clang_cl_asan %LD %Od %s %Fe%t.dll
3 // RUN: not %run %t %t.dll 2>&1 | FileCheck %s
8 void call_memcpy(void* (*f
)(void *, const void *, size_t),
9 void *a
, const void *b
, size_t c
) {
13 extern "C" __declspec(dllexport
)
15 char buff1
[6] = "Hello", buff2
[5];
17 call_memcpy(&memcpy
, buff2
, buff1
, 5);
18 if (buff1
[2] != buff2
[2])
20 printf("Initial test OK\n");
22 // CHECK: Initial test OK
24 call_memcpy(&memcpy
, buff2
, buff1
, 6);
25 // CHECK: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]
26 // CHECK: WRITE of size 6 at [[ADDR]] thread T0
27 // CHECK-NEXT: mem{{.*}}
28 // CHECK-NEXT: call_memcpy
29 // CHECK-NEXT: test_function {{.*}}dll_intercept_memcpy_indirect.cpp:[[@LINE-5]]
30 // CHECK: Address [[ADDR]] is located in stack of thread T0 at offset {{.*}} in frame
31 // CHECK-NEXT: test_function {{.*}}dll_intercept_memcpy_indirect.cpp
32 // CHECK: 'buff2'{{.*}} <== Memory access at offset {{.*}} overflows this variable