small changes to libfuzzer driver

This commit is contained in:
van Hauser
2020-06-01 13:37:50 +02:00
parent ac998e9222
commit 9a65fe904d

View File

@ -252,27 +252,27 @@ int main(int argc, char **argv) {
else if(argc == 2 && (N = atoi(argv[1])) > 0) else if(argc == 2 && (N = atoi(argv[1])) > 0)
Printf("WARNING: using the deprecated call style `%s %d`\n", argv[0], N); Printf("WARNING: using the deprecated call style `%s %d`\n", argv[0], N);
else if (argc > 1) { else if (argc > 1) {
if (!getenv("AFL_DRIVER_DONT_DEFER")) { // if (!getenv("AFL_DRIVER_DONT_DEFER")) {
__afl_sharedmem_fuzzing = 0; __afl_sharedmem_fuzzing = 0;
__afl_manual_init(); __afl_manual_init();
} // }
return ExecuteFilesOnyByOne(argc, argv); return ExecuteFilesOnyByOne(argc, argv);
exit(0); exit(0);
} }
assert(N > 0); assert(N > 0);
if (!getenv("AFL_DRIVER_DONT_DEFER"))
__afl_manual_init();
// Call LLVMFuzzerTestOneInput here so that coverage caused by initialization // Call LLVMFuzzerTestOneInput here so that coverage caused by initialization
// on the first execution of LLVMFuzzerTestOneInput is ignored. // on the first execution of LLVMFuzzerTestOneInput is ignored.
uint8_t dummy_input[1] = {0}; uint8_t dummy_input[1] = {0};
LLVMFuzzerTestOneInput(dummy_input, 1); LLVMFuzzerTestOneInput(dummy_input, 1);
// if (!getenv("AFL_DRIVER_DONT_DEFER"))
__afl_manual_init();
int num_runs = 0; int num_runs = 0;
while (__afl_persistent_loop(N)) { while (__afl_persistent_loop(N)) {
if (__afl_fuzz_len > 0) { if (__afl_fuzz_len) {
num_runs++; num_runs++;
LLVMFuzzerTestOneInput(__afl_fuzz_ptr, __afl_fuzz_len); LLVMFuzzerTestOneInput(__afl_fuzz_ptr, __afl_fuzz_len);
} }