fix for afl-compiler-rt to only send dictionary data if there is some
MODIFY
custom_mutators/libfuzzer/FuzzerDriver.cpp
custom_mutators/libfuzzer/FuzzerDriver.cpp
@@ -77,7 +77,7 @@ struct {
} Flags;
static const FlagDescription FlagDescriptions[]{
-\
+
#define FUZZER_DEPRECATED_FLAG(Name) \
{#Name, "Deprecated; don't use", 0, nullptr, nullptr, nullptr},
#define FUZZER_FLAG_INT(Name, Default, Description) \

MODIFY
custom_mutators/libfuzzer/FuzzerExtFunctionsDlsym.cpp
custom_mutators/libfuzzer/FuzzerExtFunctionsDlsym.cpp
@@ -45,8 +45,8 @@ namespace fuzzer {
ExternalFunctions::ExternalFunctions() {
\
- #define EXT_FUNC(NAME, RETURN_TYPE, FUNC_SIG, WARN) \
- this->NAME = GetFnPtr<decltype(ExternalFunctions::NAME)>(#NAME, WARN)
+ #define EXT_FUNC(NAME, RETURN_TYPE, FUNC_SIG, WARN) this->NAME =
+ GetFnPtr < decltype(ExternalFunctions::NAME)>(#NAME, WARN)
#include "FuzzerExtFunctions.def"

MODIFY
custom_mutators/libfuzzer/FuzzerExtFunctionsWeak.cpp
custom_mutators/libfuzzer/FuzzerExtFunctionsWeak.cpp
@@ -46,9 +46,8 @@ namespace fuzzer {
ExternalFunctions::ExternalFunctions() {
\
- #define EXT_FUNC(NAME, RETURN_TYPE, FUNC_SIG, WARN) \
- this->NAME = ::NAME; \
- CheckFnPtr(reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(::NAME)), \
+ #define EXT_FUNC(NAME, RETURN_TYPE, FUNC_SIG, WARN) this->NAME = ::NAME;
+ CheckFnPtr(reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(::NAME)),
#NAME, WARN);
#include "FuzzerExtFunctions.def"

MODIFY
custom_mutators/libfuzzer/FuzzerExtFunctionsWindows.cpp
custom_mutators/libfuzzer/FuzzerExtFunctionsWindows.cpp
@@ -45,14 +45,15 @@ using namespace fuzzer;
#endif // LIBFUZZER_MSVC
extern "C" {
-\
- #define EXT_FUNC(NAME, RETURN_TYPE, FUNC_SIG, WARN) \
- RETURN_TYPE NAME##Def FUNC_SIG { \
- \
- Printf("ERROR: Function \"%s\" not defined.\n", #NAME); \
- exit(1); \
- \
- } \
+
+#define EXT_FUNC(NAME, RETURN_TYPE, FUNC_SIG, WARN)
+ RETURN_TYPE NAME##Def FUNC_SIG {
+
+ Printf("ERROR: Function \"%s\" not defined.\n", #NAME);
+ exit(1);
+
+}
+
EXTERNAL_FUNC(NAME, NAME##Def) RETURN_TYPE NAME FUNC_SIG
#include "FuzzerExtFunctions.def"
@@ -80,8 +81,8 @@ namespace fuzzer {
ExternalFunctions::ExternalFunctions() {
\
- #define EXT_FUNC(NAME, RETURN_TYPE, FUNC_SIG, WARN) \
- this->NAME = GetFnPtr<decltype(::NAME)>(::NAME, ::NAME##Def, #NAME, WARN);
+ #define EXT_FUNC(NAME, RETURN_TYPE, FUNC_SIG, WARN) this->NAME =
+ GetFnPtr < decltype(::NAME)>(::NAME, ::NAME##Def, #NAME, WARN);
#include "FuzzerExtFunctions.def"

MODIFY
instrumentation/afl-compiler-rt.o.c
instrumentation/afl-compiler-rt.o.c
@@ -469,7 +469,8 @@ static void __afl_start_snapshots(void) {
}
if ((was_killed & (FS_OPT_ENABLED | FS_OPT_AUTODICT)) ==
- (FS_OPT_ENABLED | FS_OPT_AUTODICT)) {
+ (FS_OPT_ENABLED | FS_OPT_AUTODICT) &&
+ __afl_dictionary_len && __afl_dictionary) {
// great lets pass the dictionary through the forkserver FD
u32 len = __afl_dictionary_len, offset = 0;
@@ -681,7 +682,8 @@ static void __afl_start_forkserver(void) {
}
if ((was_killed & (FS_OPT_ENABLED | FS_OPT_AUTODICT)) ==
- (FS_OPT_ENABLED | FS_OPT_AUTODICT)) {
+ (FS_OPT_ENABLED | FS_OPT_AUTODICT) &&
+ __afl_dictionary_len && __afl_dictionary) {
// great lets pass the dictionary through the forkserver FD
u32 len = __afl_dictionary_len, offset = 0;

fix for afl-compiler-rt to only send dictionary data if there is some