@@ -149,7 +149,6 @@ class Engine(engine.Engine):
149149
150150 def __init__ (self ):
151151 super ().__init__ ()
152- self .workdir = self ._create_temp_dir ('workdir' )
153152
154153 @property
155154 def name (self ):
@@ -202,7 +201,8 @@ def prepare(self, corpus_dir, target_path, build_dir):
202201 # 1. Centipede-readable corpus file;
203202 # 2. Centipede-readable feature file;
204203 # 3. Crash reproducing inputs.
205- arguments [constants .WORKDIR_FLAGNAME ] = str (self .workdir )
204+ workdir = self ._create_temp_dir ('workdir' )
205+ arguments [constants .WORKDIR_FLAGNAME ] = str (workdir )
206206
207207 # Directory corpus_dir saves the corpus files required by ClusterFuzz.
208208 arguments [constants .CORPUS_DIR_FLAGNAME ] = corpus_dir
@@ -301,7 +301,12 @@ def fuzz(self, target_path, options, reproducers_dir, max_time): # pylint: disa
301301 int (fuzz_result .time_executed )))
302302
303303 stats_filename = f'fuzzing-stats-{ os .path .basename (target_path )} .000000.csv'
304- stats_file = os .path .join (self .workdir , stats_filename )
304+ args = fuzzer_options .FuzzerArguments .from_list (options .arguments )
305+ assert args is not None
306+ assert constants .WORKDIR_FLAGNAME in args
307+
308+ workdir = args [constants .WORKDIR_FLAGNAME ]
309+ stats_file = os .path .join (workdir , stats_filename )
305310 stats = _parse_centipede_stats (stats_file )
306311 if not stats :
307312 stats = {}
@@ -505,9 +510,10 @@ def minimize_testcase(self, target_path, arguments, input_path, output_path,
505510 TimeoutError: If the testcase minimization exceeds max_time.
506511 """
507512 runner = _get_runner (target_path )
513+ workdir = self ._create_temp_dir ('workdir' )
508514 args = [
509515 f'--binary={ target_path } ' ,
510- f'--workdir={ self . workdir } ' ,
516+ f'--workdir={ workdir } ' ,
511517 f'--minimize_crash={ input_path } ' ,
512518 f'--num_runs={ constants .NUM_RUNS_PER_MINIMIZATION } ' ,
513519 '--seed=1' ,
@@ -517,7 +523,7 @@ def minimize_testcase(self, target_path, arguments, input_path, output_path,
517523 logs .warning (
518524 'Testcase minimization timed out.' , fuzzer_output = result .output )
519525 raise TimeoutError ('Minimization timed out.' )
520- minimum_testcase = self ._get_smallest_crasher (self . workdir )
526+ minimum_testcase = self ._get_smallest_crasher (workdir )
521527 if minimum_testcase :
522528 shutil .copyfile (minimum_testcase , output_path )
523529 else :
0 commit comments