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