1//===-- libc gwp asan crash test ------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include <stdlib.h>
10
11int main() {
12 char retval = 0;
13 for (unsigned i = 0; i < 0x10000; ++i) {
14 char *Ptr = reinterpret_cast<char *>(malloc(size: 10));
15
16 for (unsigned i = 0; i < 10; ++i) {
17 *(Ptr + i) = 0x0;
18 }
19
20 free(ptr: Ptr);
21 volatile char x = *Ptr;
22 retval = retval + x;
23 }
24 return retval;
25}
26

source code of libc/test/integration/scudo/gwp_asan_should_crash.cpp