[ASan/Win tests] Remove the extra 'cat' in front of FileCheck now that it's clear...
[blocksruntime.git] / test / asan / TestCases / Windows / dll_malloc_uaf.cc
blob5842999fdf32423e26b6fe89fd8622dc95ef6e64
1 // RUN: %clangxx_asan -O0 %p/dll_host.cc -Fe%t
2 // RUN: %clangxx_asan -LD -O0 %s -Fe%t.dll
3 // RUN: not %run %t %t.dll 2>&1 | FileCheck %s
5 #include <malloc.h>
7 extern "C" __declspec(dllexport)
8 int test_function() {
9 int *buffer = (int*)malloc(42);
10 free(buffer);
11 buffer[0] = 42;
12 // CHECK: AddressSanitizer: heap-use-after-free on address [[ADDR:0x[0-9a-f]+]]
13 // CHECK: WRITE of size 4 at [[ADDR]] thread T0
14 // CHECK-NEXT: test_function {{.*}}dll_malloc_uaf.cc:[[@LINE-3]]
15 // CHECK-NEXT: main {{.*}}dll_host
17 // CHECK: [[ADDR]] is located 0 bytes inside of 42-byte region
18 // CHECK-LABEL: freed by thread T0 here:
19 // CHECK-NEXT: free
20 // CHECK-NEXT: test_function {{.*}}dll_malloc_uaf.cc:[[@LINE-10]]
21 // CHECK-NEXT: main {{.*}}dll_host
23 // CHECK-LABEL: previously allocated by thread T0 here:
24 // CHECK-NEXT: malloc
25 // CHECK-NEXT: test_function {{.*}}dll_malloc_uaf.cc:[[@LINE-16]]
26 // CHECK-NEXT: main {{.*}}dll_host
27 return 0;