brintos

brintos / llvm-project-archived public Read only

0
0
Text · 539 B · a38822c Raw
17 lines · c
1// RUN: %clang_hwasan %s -o %t && not %run %t 2>&1 | FileCheck %s2 3#include <sanitizer/hwasan_interface.h>4#include <stdlib.h>5 6int main() {7  __hwasan_enable_allocator_tagging();8  char *p = (char *)malloc(1);9  free(p + 0x10000000000);10  // CHECK: ERROR: HWAddressSanitizer: invalid-free on address {{.*}} at pc {{[0x]+}}[[PC:.*]] on thread T{{[0-9]+}}11  // CHECK: #0 {{[0x]+}}{{.*}}[[PC]] in {{.*}}free12  // CHECK: #1 {{.*}} in main {{.*}}wild-free.c:[[@LINE-3]]13  // CHECK-NOT: Segmentation fault14  // CHECK-NOT: SIGSEGV15  return 0;16}17