diff options
Diffstat (limited to 'lib/asan/lit_tests/TestCases/time_interceptor.cc')
-rw-r--r-- | lib/asan/lit_tests/TestCases/time_interceptor.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/asan/lit_tests/TestCases/time_interceptor.cc b/lib/asan/lit_tests/TestCases/time_interceptor.cc new file mode 100644 index 000000000000..3be00d60c01d --- /dev/null +++ b/lib/asan/lit_tests/TestCases/time_interceptor.cc @@ -0,0 +1,16 @@ +// RUN: %clangxx_asan -O0 %s -o %t && not %t 2>&1 | 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; +} |