brintos

brintos / llvm-project-archived public Read only

0
0
Text · 558 B · 9d74996 Raw
21 lines · c
1// Sanity checking a test in pure C.2// RUN: %clang_asan -O2 %s -o %t3// RUN: not %run %t 2>&1 | FileCheck %s4 5// Sanity checking a test in pure C with -pie.6// RUN: %clang_asan -O2 %s %pie %fPIE -o %t7// RUN: not %run %t 2>&1 | FileCheck %s8// REQUIRES: stable-runtime9 10#include <stdlib.h>11int main() {12  char *x = (char*)malloc(10 * sizeof(char));13  free(x);14  return x[5];15  // CHECK: heap-use-after-free16  // CHECK: free17  // CHECK: main{{.*}}sanity_check_pure_c.c:[[@LINE-4]]18  // CHECK: malloc19  // CHECK: main{{.*}}sanity_check_pure_c.c:[[@LINE-7]]20}21