brintos

brintos / llvm-project-archived public Read only

0
0
Text · 555 B · 0c5e3fe Raw
23 lines · cpp
1// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s2 3// Test the time() interceptor.4 5// FIXME: There's no interceptor for time() on Windows yet.6// XFAIL: target={{.*windows-(msvc.*|gnu)}}7 8#include <stdio.h>9#include <stdlib.h>10#include <time.h>11 12int main() {13  time_t *tm = (time_t*)malloc(sizeof(time_t));14  free(tm);15  time_t t = time(tm);16  printf("Time: %s\n", ctime(&t));17  // CHECK: use-after-free18  // Regression check for19  // https://code.google.com/p/address-sanitizer/issues/detail?id=32120  // CHECK: SUMMARY21  return 0;22}23