1 // RUN: %clang_cl_asan %Od %p/dll_host.cpp %Fe%t
2 // RUN: %clang_cl_asan %LD %Od %s %Fe%t.dll
3 // RUN: not %run %t %t.dll 2>&1 | FileCheck %s
8 DWORD WINAPI
thread_proc(void *context
) {
10 char stack_buffer
[42];
11 stack_buffer
[subscript
] = 42;
12 // CHECK: AddressSanitizer: stack-buffer-underflow on address [[ADDR:0x[0-9a-f]+]]
13 // CHECK: WRITE of size 1 at [[ADDR]] thread T1
14 // CHECK-NEXT: thread_proc{{.*}}dll_thread_stack_array_left_oob.cpp:[[@LINE-3]]
16 // CHECK: Address [[ADDR]] is located in stack of thread T1 at offset [[OFFSET:.*]] in frame
17 // CHECK-NEXT: thread_proc{{.*}}dll_thread_stack_array_left_oob.cpp
19 // CHECK: 'stack_buffer'{{.*}} <== Memory access at offset [[OFFSET]] underflows this variable
24 extern "C" __declspec(dllexport
)
26 HANDLE thr
= CreateThread(NULL
, 0, thread_proc
, NULL
, 0, NULL
);
27 // CHECK-LABEL: Thread T1 created by T0 here:
28 // CHECK: test_function{{.*}}dll_thread_stack_array_left_oob.cpp:[[@LINE-2]]
29 // CHECK-NEXT: main{{.*}}dll_host.cpp
30 // CHECK-LABEL: SUMMARY
33 if (WAIT_OBJECT_0
!= WaitForSingleObject(thr
, INFINITE
))