try LLVMFuzzerRunDriver support
MODIFY
utils/aflpp_driver/aflpp_driver.c
utils/aflpp_driver/aflpp_driver.c
@@ -64,6 +64,8 @@ extern unsigned char *__afl_fuzz_ptr;
// libFuzzer interface is thin, so we don't include any libFuzzer headers.
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size);
__attribute__((weak)) int LLVMFuzzerInitialize(int *argc, char ***argv);
+int LLVMFuzzerRunDriver(int *argc, char ***argv,
+ int (*callback)(const uint8_t *data, size_t size));
// Default nop ASan hooks for manual posisoning when not linking the ASan
// runtime
@@ -245,7 +247,7 @@ static int ExecuteFilesOnyByOne(int argc, char **argv) {
}
-int main(int argc, char **argv) {
+__attribute__((weak)) int main(int argc, char **argv) {
if (argc < 2 || strncmp(argv[1], "-h", 2) == 0)
printf(
@@ -265,6 +267,16 @@ int main(int argc, char **argv) {
"===================================================================\n",
argv[0], argv[0]);
+ return LLVMFuzzerRunDriver(&argc, &argv, LLVMFuzzerTestOneInput);
+
+}
+
+int LLVMFuzzerRunDriver(int *argcp, char ***argvp,
+ int (*callback)(const uint8_t *data, size_t size)) {
+
+ int argc = *argcp;
+ char **argv = *argvp;
+
if (getenv("AFL_GDB")) {
char cmd[64];

try LLVMFuzzerRunDriver support