1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[libFuzzer] add ATTRIBUTE_NO_SANITIZE_MEMORY to sanitizer hooks

llvm-svn: 292295
This commit is contained in:
Kostya Serebryany 2017-01-17 23:50:21 +00:00
parent 03f571c246
commit 8e3275c8d4

View File

@ -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<const uint8_t *>(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<const uint8_t *>(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<const uint8_t *>(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<const uint8_t *>(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<const uint8_t *>(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;