summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2018-03-08 23:22:53 +0800
committerMatt Johnston <matt@ucc.asn.au>2018-03-08 23:22:53 +0800
commit933bc5f8a72342a711ab1b6b41ec0333c4fc55dd (patch)
tree85eaff15c8e30bb8441981bc842390b61b195051
parentba94bcd2e876cf79a66f3f9f4e46473f89c288c8 (diff)
Disable wrapfds outside of fuzzed code
-rw-r--r--fuzz-harness.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fuzz-harness.c b/fuzz-harness.c
index 53bc71f..be23d4e 100644
--- a/fuzz-harness.c
+++ b/fuzz-harness.c
@@ -18,6 +18,7 @@ int main(int argc, char ** argv) {
#endif
}
+ int old_fuzz_wrapfds = 0;
for (i = 1; i < argc; i++) {
if (argv[i][0] == '-') {
/* ignore arguments */
@@ -29,11 +30,16 @@ int main(int argc, char ** argv) {
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");