Skip to content

Commit 03dc87e

Browse files
committed
Revert "[sanitizer][asan][win] Intercept _strdup on Windows instead of strdup"
This reverts commit 3126321. Reason: Broke the ASan Windows bot: https://reviews.llvm.org/rG31263211c6a4ef454216f2edbf9b2083a4c1474d
1 parent 3f8ef57 commit 03dc87e

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

compiler-rt/lib/asan/asan_interceptors.cpp

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -539,17 +539,6 @@ INTERCEPTOR(char *, strcpy, char *to, const char *from) {
539539
return REAL(strcpy)(to, from);
540540
}
541541

542-
// Windows doesn't always define the strdup identifier,
543-
// and when it does it's a macro defined to either _strdup
544-
// or _strdup_dbg, _strdup_dbg ends up calling _strdup, so
545-
// we want to intercept that. push/pop_macro are used to avoid problems
546-
// if this file ends up including <string.h> in the future.
547-
# if SANITIZER_WINDOWS
548-
# pragma push_macro("strdup")
549-
# undef strdup
550-
# define strdup _strdup
551-
# endif
552-
553542
INTERCEPTOR(char*, strdup, const char *s) {
554543
void *ctx;
555544
ASAN_INTERCEPTOR_ENTER(ctx, strdup);
@@ -567,7 +556,7 @@ INTERCEPTOR(char*, strdup, const char *s) {
567556
return reinterpret_cast<char*>(new_mem);
568557
}
569558

570-
# if ASAN_INTERCEPT___STRDUP
559+
#if ASAN_INTERCEPT___STRDUP
571560
INTERCEPTOR(char*, __strdup, const char *s) {
572561
void *ctx;
573562
ASAN_INTERCEPTOR_ENTER(ctx, strdup);
@@ -753,7 +742,7 @@ void InitializeAsanInterceptors() {
753742
ASAN_INTERCEPT_FUNC(strncat);
754743
ASAN_INTERCEPT_FUNC(strncpy);
755744
ASAN_INTERCEPT_FUNC(strdup);
756-
# if ASAN_INTERCEPT___STRDUP
745+
#if ASAN_INTERCEPT___STRDUP
757746
ASAN_INTERCEPT_FUNC(__strdup);
758747
#endif
759748
#if ASAN_INTERCEPT_INDEX && ASAN_USE_ALIAS_ATTRIBUTE_FOR_INDEX
@@ -842,10 +831,6 @@ void InitializeAsanInterceptors() {
842831
VReport(1, "AddressSanitizer: libc interceptors initialized\n");
843832
}
844833

845-
# if SANITIZER_WINDOWS
846-
# pragma pop_macro("strdup")
847-
# endif
848-
849834
} // namespace __asan
850835

851836
#endif // !SANITIZER_FUCHSIA

0 commit comments

Comments
 (0)