From: Kuba Brecka Date: Tue, 21 Jul 2015 15:27:40 +0000 (+0000) Subject: Reverting r242787 ("[asan] Fix the freopen interceptor to allow NULL instead of a... X-Git-Tag: studio-1.4~1991 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e40677434bc5ccf0ffefa2c9cdf7f07b7863b7ea;p=platform%2Fupstream%2Fllvm.git Reverting r242787 ("[asan] Fix the freopen interceptor to allow NULL instead of a filename") to investigate buildbot failure. llvm-svn: 242791 --- diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc index 6ff0ae1..c7dc475 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc @@ -4671,7 +4671,7 @@ INTERCEPTOR(__sanitizer_FILE *, freopen, const char *path, const char *mode, __sanitizer_FILE *fp) { void *ctx; COMMON_INTERCEPTOR_ENTER(ctx, freopen, path, mode, fp); - if (path) COMMON_INTERCEPTOR_READ_RANGE(ctx, path, REAL(strlen)(path) + 1); + COMMON_INTERCEPTOR_READ_RANGE(ctx, path, REAL(strlen)(path) + 1); COMMON_INTERCEPTOR_READ_RANGE(ctx, mode, REAL(strlen)(mode) + 1); COMMON_INTERCEPTOR_FILE_CLOSE(ctx, fp); __sanitizer_FILE *res = REAL(freopen)(path, mode, fp); @@ -4702,7 +4702,7 @@ INTERCEPTOR(__sanitizer_FILE *, freopen64, const char *path, const char *mode, __sanitizer_FILE *fp) { void *ctx; COMMON_INTERCEPTOR_ENTER(ctx, freopen64, path, mode, fp); - if (path) COMMON_INTERCEPTOR_READ_RANGE(ctx, path, REAL(strlen)(path) + 1); + COMMON_INTERCEPTOR_READ_RANGE(ctx, path, REAL(strlen)(path) + 1); COMMON_INTERCEPTOR_READ_RANGE(ctx, mode, REAL(strlen)(mode) + 1); COMMON_INTERCEPTOR_FILE_CLOSE(ctx, fp); __sanitizer_FILE *res = REAL(freopen64)(path, mode, fp); diff --git a/compiler-rt/test/asan/TestCases/Posix/freopen.cc b/compiler-rt/test/asan/TestCases/Posix/freopen.cc index d2cd853..e69de29 100644 --- a/compiler-rt/test/asan/TestCases/Posix/freopen.cc +++ b/compiler-rt/test/asan/TestCases/Posix/freopen.cc @@ -1,12 +0,0 @@ -// RUN: %clangxx_asan -O0 %s -o %t && %run %t - -#include -#include - -int main() { - FILE *fp = fopen("/dev/null", "w"); - assert(fp); - freopen(NULL, "a", fp); - fclose(fp); - return 0; -}