From 0d1c22f66866128c7d32ba54438dbc6c8831751a Mon Sep 17 00:00:00 2001 From: ifratric Date: Wed, 1 Dec 2021 17:49:49 +0100 Subject: [PATCH] implement dry run --- fuzzer.cpp | 6 ++++++ fuzzer.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/fuzzer.cpp b/fuzzer.cpp index 3569a99..77346bd 100644 --- a/fuzzer.cpp +++ b/fuzzer.cpp @@ -107,6 +107,8 @@ void Fuzzer::ParseOptions(int argc, char **argv) { track_ranges = GetBinaryOption("-track_ranges", argc, argv, false); Sample::max_size = (size_t)GetIntOption("-max_sample_size", argc, argv, DEFAULT_MAX_SAMPLE_SIZE); + + dry_run = GetBinaryOption("-dry_run", argc, argv, false); } void Fuzzer::SetupDirectories() { @@ -596,6 +598,10 @@ void Fuzzer::SynchronizeAndGetJob(ThreadContext* tc, FuzzerJob* job) { } // create a job according to the state + if ((state == FUZZING) && dry_run) { + printf("Dry run done"); + exit(0); + } if (state == FUZZING) { if (sample_queue.empty()) { diff --git a/fuzzer.h b/fuzzer.h index 3ed4e7f..4f0d703 100644 --- a/fuzzer.h +++ b/fuzzer.h @@ -240,6 +240,8 @@ class Fuzzer { bool clean_target_on_coverage; bool should_restore_state; + + bool dry_run; Mutex crash_mutex; std::unordered_map unique_crashes;