# HG changeset patch # User Matt Johnston # Date 1520522573 -28800 # Node ID bff41a61a1b6008662101955e11486bd222d84dc # Parent 99ca393afc568022a62e99e02f3e7f4aa0f1e607 Disable wrapfds outside of fuzzed code diff -r 99ca393afc56 -r bff41a61a1b6 fuzz-harness.c --- a/fuzz-harness.c Thu Mar 08 22:37:54 2018 +0800 +++ b/fuzz-harness.c Thu Mar 08 23:22:53 2018 +0800 @@ -18,6 +18,7 @@ #endif } + int old_fuzz_wrapfds = 0; for (i = 1; i < argc; i++) { if (argv[i][0] == '-') { /* ignore arguments */ @@ -29,11 +30,16 @@ buf_readfile(input, fn); buf_setpos(input, 0); + fuzz.wrapfds = old_fuzz_wrapfds; printf("Running %s once \n", fn); LLVMFuzzerTestOneInput(input->data, input->len); printf("Running %s twice \n", fn); LLVMFuzzerTestOneInput(input->data, input->len); printf("Done %s\n", fn); + + /* Disable wrapfd so it won't interfere with buf_readfile() above */ + old_fuzz_wrapfds = fuzz.wrapfds; + fuzz.wrapfds = 0; } printf("Finished\n");