[ASan/Win tests] Remove the extra 'cat' in front of FileCheck now that it's clear...
[blocksruntime.git] / test / asan / TestCases / Windows / dll_poison_unpoison.cc
blob24f98dd39e46e6b8cd71c917a85f87fe890debf4
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 <sanitizer/asan_interface.h>
7 void should_not_crash(volatile char *c) {
8 *c = 42;
11 void should_crash(volatile char *c) {
12 *c = 42;
15 extern "C" __declspec(dllexport)
16 int test_function() {
17 char buffer[256];
18 should_not_crash(&buffer[0]);
19 __asan_poison_memory_region(buffer, 128);
20 should_not_crash(&buffer[192]);
21 __asan_unpoison_memory_region(buffer, 64);
22 should_not_crash(&buffer[32]);
24 should_crash(&buffer[96]);
25 // CHECK: AddressSanitizer: use-after-poison on address [[ADDR:0x[0-9a-f]+]]
26 // CHECK-NEXT: WRITE of size 1 at [[ADDR]] thread T0
27 // CHECK-NEXT: should_crash {{.*}}\dll_poison_unpoison.cc
28 // CHECK-NEXT: test_function {{.*}}\dll_poison_unpoison.cc:[[@LINE-4]]
29 // CHECK-NEXT: main
31 // CHECK: [[ADDR]] is located in stack of thread T0 at offset [[OFFSET:.*]] in frame
32 // CHECK-NEXT: test_function {{.*}}\dll_poison_unpoison.cc
33 // CHECK: 'buffer' <== Memory access at offset [[OFFSET]] is inside this variable
34 return 0;