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
8 extern "C" __declspec(dllexport
)
10 int *buffer
= (int*)malloc(42);
13 // CHECK: AddressSanitizer: heap-use-after-free on address [[ADDR:0x[0-9a-f]+]]
14 // CHECK: WRITE of size 4 at [[ADDR]] thread T0
15 // CHECK-NEXT: test_function {{.*}}dll_malloc_uaf.cc:[[@LINE-3]]
16 // CHECK-NEXT: main {{.*}}dll_host
18 // CHECK: [[ADDR]] is located 0 bytes inside of 42-byte region
19 // CHECK-LABEL: freed by thread T0 here:
21 // CHECK: test_function {{.*}}dll_malloc_uaf.cc:[[@LINE-10]]
22 // CHECK-NEXT: main {{.*}}dll_host
24 // CHECK-LABEL: previously allocated by thread T0 here:
26 // CHECK: test_function {{.*}}dll_malloc_uaf.cc:[[@LINE-16]]
27 // CHECK-NEXT: main {{.*}}dll_host