diff --git a/fuzz.c b/fuzz.c index 9a1f83419..6765cce3d 100644 --- a/fuzz.c +++ b/fuzz.c @@ -397,11 +397,11 @@ static bool fuzz_fetchInput(run_t* run) { return false; } } else if (run->global->exe.feedbackMutateCommand) { - if (!input_prepareStaticFile(run, true, false)) { + if (!input_prepareStaticFile(run, /* rewind= */ true, /* mangle= */ false)) { LOG_E("input_prepareStaticFile() failed"); return false; } - } else if (!input_prepareStaticFile(run, true /* rewind */, true)) { + } else if (!input_prepareStaticFile(run, /* rewind= */ true, /* mangle= */ true)) { LOG_E("input_prepareStaticFile() failed"); return false; } diff --git a/hfuzz_cc/hfuzz-cc.c b/hfuzz_cc/hfuzz-cc.c index 095d87e7b..0acf6828f 100644 --- a/hfuzz_cc/hfuzz-cc.c +++ b/hfuzz_cc/hfuzz-cc.c @@ -371,6 +371,7 @@ static void commonPreOpts(int* j, char** args) { args[(*j)++] = "-mllvm"; args[(*j)++] = "-inline-threshold=1000"; } + args[(*j)++] = "-fno-builtin"; args[(*j)++] = "-fno-omit-frame-pointer"; args[(*j)++] = "-D__NO_STRING_INLINES"; @@ -506,6 +507,10 @@ static int ldMode(int argc, char** argv) { args[j++] = "-Wl,--wrap=Curl_safe_strcasecompare"; args[j++] = "-Wl,--wrap=Curl_strncasecompare"; args[j++] = "-Wl,--wrap=curl_strnequal"; + /* SQLite3 */ + args[j++] = "-Wl,--wrap=sqlite3_stricmp"; + args[j++] = "-Wl,--wrap=sqlite3_strnicmp"; + args[j++] = "-Wl,--wrap=sqlite3StrICmp"; #endif /* _HF_ARCH_DARWIN */ /* Pull modules defining the following symbols (if they exist) */ diff --git a/libhfuzz/memorycmp.c b/libhfuzz/memorycmp.c index 90b91f50e..76252c367 100644 --- a/libhfuzz/memorycmp.c +++ b/libhfuzz/memorycmp.c @@ -665,6 +665,18 @@ HF_WEAK_WRAP(int, curl_strnequal, const char* first, const char* second, size_t return 0; } +/* SQLite3 wrappers */ +HF_WEAK_WRAP(int, sqlite3_stricmp, const char* s1, const char* s2) { + return HF_strcasecmp(s1, s2, tolower, (uintptr_t)__builtin_return_address(0)); +} +HF_WEAK_WRAP(int, sqlite3StrICmp, const char* s1, const char* s2) { + return HF_strcasecmp(s1, s2, tolower, (uintptr_t)__builtin_return_address(0)); +} +HF_WEAK_WRAP(int, sqlite3_strnicmp, const char* s1, const char* s2, size_t len) { + return HF_strncasecmp( + s1, s2, len, tolower, /* constfb= */ true, (uintptr_t)__builtin_return_address(0)); +} + /* C++ wrappers */ int _ZNSt11char_traitsIcE7compareEPKcS2_m(const char* s1, const char* s2, size_t count) { return HF_memcmp(s1, s2, count, instrumentConstAvail(), (uintptr_t)__builtin_return_address(0));