summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/lit_tests/time_interceptor.cc
blob: f5f2ad62b815d771fba06046cc02c10f513834cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s

// Test the time() interceptor.

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main() {
  time_t *tm = (time_t*)malloc(sizeof(time_t));
  free(tm);
  time_t t = time(tm);
  printf("Time: %s\n", ctime(&t));  // NOLINT
  // CHECK: use-after-free
  return 0;
}
OpenPOWER on IntegriCloud