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