[LVI] Add trunc to i1 handling. (#124480)
[llvm-project.git] / compiler-rt / test / asan / TestCases / Windows / dll_malloc_left_oob.cpp
blob5ca48fbd68384030153a19278b7187db2c9b0d56
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
5 #include <malloc.h>
6 extern "C" __declspec(dllexport)
7 int test_function() {
8 char *buffer = (char*)malloc(42);
9 buffer[-1] = 42;
10 // CHECK: AddressSanitizer: heap-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]
11 // CHECK: WRITE of size 1 at [[ADDR]] thread T0
12 // CHECK-NEXT: test_function {{.*}}dll_malloc_left_oob.cpp:[[@LINE-3]]
13 // CHECK-NEXT: main {{.*}}dll_host.cpp
15 // CHECK: [[ADDR]] is located 1 bytes before 42-byte region
16 // CHECK-LABEL: allocated by thread T0 here:
17 // CHECK-NEXT: malloc
18 // CHECK: test_function {{.*}}dll_malloc_left_oob.cpp:[[@LINE-10]]
19 // CHECK-NEXT: main {{.*}}dll_host.cpp
20 // CHECK-LABEL: SUMMARY
21 free(buffer);
22 return 0;