Index: lib/Fuzzer/afl/afl_driver.cpp =================================================================== --- lib/Fuzzer/afl/afl_driver.cpp +++ lib/Fuzzer/afl/afl_driver.cpp @@ -50,6 +50,7 @@ */ #include "../Support/Util.h" +#include "../Support/UtilIO.h" #include #include #include @@ -67,7 +68,7 @@ // to the file as well, if the error occurs after the duplication is performed. #define CHECK_ERROR(cond, error_message) \ if (!(cond)) { \ - fprintf(stderr, (error_message)); \ + fuzzer::Printf(error_message); \ abort(); \ } @@ -195,24 +196,23 @@ freopen(stderr_duplicate_filename, "a+", stderr); if (!stderr_duplicate_stream) { - fprintf( - stderr, + fuzzer::Printf( "Failed to duplicate stderr to AFL_DRIVER_STDERR_DUPLICATE_FILENAME"); abort(); } } int main(int argc, char **argv) { - fprintf(stderr, "======================= INFO =========================\n" - "This binary is built for AFL-fuzz.\n" - "To run the target function on a single input execute this:\n" - " %s < INPUT_FILE\n" - "To run the fuzzing execute this:\n" - " afl-fuzz [afl-flags] %s [N] " - "-- run N fuzzing iterations before " - "re-spawning the process (default: 1000)\n" - "======================================================\n", - argv[0], argv[0]); + fuzzer::Printf("======================= INFO =========================\n" + "This binary is built for AFL-fuzz.\n" + "To run the target function on a single input execute this:\n" + " %s < INPUT_FILE\n" + "To run the fuzzing execute this:\n" + " afl-fuzz [afl-flags] %s [N] " + "-- run N fuzzing iterations before " + "re-spawning the process (default: 1000)\n" + "======================================================\n", + argv[0], argv[0]); if (LLVMFuzzerInitialize) LLVMFuzzerInitialize(&argc, &argv); // Do any other expensive one-time initialization here. @@ -251,5 +251,5 @@ delete[] copy; } } - fprintf(stderr, "%s: successfully executed %d input(s)\n", argv[0], num_runs); + fuzzer::Printf("%s: successfully executed %d input(s)\n", argv[0], num_runs); }