1 // RUN: %clang_cl_asan %Od %s %Fe%t %MD
2 // RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s
3 // UNSUPPORTED: asan-64-bits
8 using AllocateFunctionPtr
= PVOID(__stdcall
*)(PVOID
, ULONG
, SIZE_T
);
9 using FreeFunctionPtr
= PVOID(__stdcall
*)(PVOID
, ULONG
, PVOID
);
12 HMODULE NtDllHandle
= GetModuleHandle("ntdll.dll");
14 puts("Couldn't load ntdll??");
18 auto RtlAllocateHeap_ptr
= (AllocateFunctionPtr
)GetProcAddress(NtDllHandle
, "RtlAllocateHeap");
19 if (RtlAllocateHeap_ptr
== 0) {
20 puts("Couldn't RtlAllocateHeap");
25 buffer
= (char *)RtlAllocateHeap_ptr(GetProcessHeap(), 0, 32),
27 // CHECK: AddressSanitizer: heap-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]
28 // CHECK: WRITE of size 1 at [[ADDR]] thread T0