[ASan/Win tests] Remove the extra 'cat' in front of FileCheck now that it's clear...
[blocksruntime.git] / test / asan / TestCases / Windows / dll_intercept_strlen.cc
blobcaac42647e1071a24a08cc58e0257366efc20671
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 <stdio.h>
6 #include <string.h>
8 extern "C" __declspec(dllexport)
9 int test_function() {
10 char str[] = "Hello!";
11 if (6 != strlen(str))
12 return 1;
13 printf("Initial test OK\n");
14 fflush(0);
15 // CHECK: Initial test OK
17 str[6] = '!'; // Removes '\0' at the end!
18 int len = strlen(str);
19 // CHECK: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]
20 // FIXME: Should be READ of size 1, see issue 155.
21 // CHECK: READ of size {{[0-9]+}} at [[ADDR]] thread T0
22 // CHECK-NEXT: {{#0 .*}}strlen
23 // CHECK-NEXT: {{#1 .* test_function .*}}dll_intercept_strlen.cc:[[@LINE-5]]
25 // CHECK: Address [[ADDR]] is located in stack of thread T0 at offset {{.*}} in frame
26 // CHECK-NEXT: test_function {{.*}}dll_intercept_strlen.cc:
27 return len > 42;