brintos

brintos / llvm-project-archived public Read only

0
0
Text · 556 B · 19d2943 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  realloc(p + 0x10000000000, 2);10  // CHECK: ERROR: HWAddressSanitizer: invalid-free on address {{.*}} at pc {{[0x]+}}[[PC:.*]] on thread T{{[0-9]+}}11  // CHECK: #0 {{[0x]+}}{{.*}}[[PC]] in {{.*}}realloc12  // CHECK: #1 {{.*}} in main {{.*}}wild-free-realloc.c:[[@LINE-3]]13  // CHECK-NOT: Segmentation fault14  // CHECK-NOT: SIGSEGV15  return 0;16}17