diff --git a/lib/Fuzzer/FuzzerTraceState.cpp b/lib/Fuzzer/FuzzerTraceState.cpp index 8c812512fd1..f5dc2331c2e 100644 --- a/lib/Fuzzer/FuzzerTraceState.cpp +++ b/lib/Fuzzer/FuzzerTraceState.cpp @@ -215,6 +215,8 @@ extern "C" { #endif #if LLVM_FUZZER_DEFINES_SANITIZER_WEAK_HOOOKS + +ATTRIBUTE_NO_SANITIZE_MEMORY void __sanitizer_weak_hook_memcmp(void *caller_pc, const void *s1, const void *s2, size_t n, int result) { if (result == 0) return; // No reason to mutate. @@ -225,6 +227,7 @@ void __sanitizer_weak_hook_memcmp(void *caller_pc, const void *s1, reinterpret_cast(s2)); } +ATTRIBUTE_NO_SANITIZE_MEMORY void __sanitizer_weak_hook_strncmp(void *caller_pc, const char *s1, const char *s2, size_t n, int result) { if (result == 0) return; // No reason to mutate. @@ -239,6 +242,8 @@ void __sanitizer_weak_hook_strncmp(void *caller_pc, const char *s1, reinterpret_cast(s2)); } + +ATTRIBUTE_NO_SANITIZE_MEMORY void __sanitizer_weak_hook_strcmp(void *caller_pc, const char *s1, const char *s2, int result) { if (result == 0) return; // No reason to mutate. @@ -252,22 +257,31 @@ void __sanitizer_weak_hook_strcmp(void *caller_pc, const char *s1, reinterpret_cast(s2)); } +ATTRIBUTE_NO_SANITIZE_MEMORY void __sanitizer_weak_hook_strncasecmp(void *called_pc, const char *s1, const char *s2, size_t n, int result) { return __sanitizer_weak_hook_strncmp(called_pc, s1, s2, n, result); } + +ATTRIBUTE_NO_SANITIZE_MEMORY void __sanitizer_weak_hook_strcasecmp(void *called_pc, const char *s1, const char *s2, int result) { return __sanitizer_weak_hook_strcmp(called_pc, s1, s2, result); } + +ATTRIBUTE_NO_SANITIZE_MEMORY void __sanitizer_weak_hook_strstr(void *called_pc, const char *s1, const char *s2, char *result) { TS->AddInterestingWord(reinterpret_cast(s2), strlen(s2)); } + +ATTRIBUTE_NO_SANITIZE_MEMORY void __sanitizer_weak_hook_strcasestr(void *called_pc, const char *s1, const char *s2, char *result) { TS->AddInterestingWord(reinterpret_cast(s2), strlen(s2)); } + +ATTRIBUTE_NO_SANITIZE_MEMORY void __sanitizer_weak_hook_memmem(void *called_pc, const void *s1, size_t len1, const void *s2, size_t len2, void *result) { if (fuzzer::DoingMyOwnMemmem) return;