1 | // REQUIRES: gwp_asan |
---|---|
2 | // RUN: %clangxx_gwp_asan %s -o %t |
3 | // RUN: %expect_crash %run %t 2>&1 | FileCheck %s |
4 | |
5 | // CHECK: GWP-ASan detected a memory error |
6 | // CHECK: Invalid (Wild) Free at 0x{{[a-f0-9]+}} (1 byte to the right of a |
7 | // CHECK-SAME: 1-byte allocation |
8 | |
9 | #include <cstdlib> |
10 | |
11 | int main() { |
12 | char *Ptr = |
13 | reinterpret_cast<char *>(malloc(1)); |
14 | free(Ptr + 1); |
15 | return 0; |
16 | } |
17 |