Alexander Potapenko 853a232e66 [ASan] Fix https://code.google.com/p/address-sanitizer/issues/detail?id=321 for time() and frexp()
Add a test for the frexp() interceptor.
Annotate the interceptors that may potentially corrupt stack IDs of freed buffers with FIXME comments.

llvm-svn: 211153
2014-06-18 09:27:40 +00:00

23 lines
531 B
C++

// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
// Test the time() interceptor.
// There's no interceptor for time() on Windows yet.
// XFAIL: win32
#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
// Regression check for
// https://code.google.com/p/address-sanitizer/issues/detail?id=321
// CHECK: SUMMARY
return 0;
}