brintos

brintos / llvm-project-archived public Read only

0
0
Text · 683 B · 4165ccd Raw
26 lines · cpp
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-exception6//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(10));15 16    for (unsigned i = 0; i < 10; ++i) {17      *(Ptr + i) = 0x0;18    }19 20    free(Ptr);21    volatile char x = *Ptr;22    retval = retval + x;23  }24  return retval;25}26