Skip to content

Commit b6cd745

Browse files
committed
call gen_paths() in --cover-corpus mode
1 parent 259cfe6 commit b6cd745

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

afl-cov

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,14 @@ def process_afl_test_cases(cargs):
136136
afl_files.append(f)
137137
new_files.append(f) # needed below to check if sleep is necessary
138138

139-
# set up directories
140-
if not cargs.afl_fuzzing_dir:
141-
print "[*] Must specify AFL fuzzing dir with --afl-fuzzing-dir or -d"
142-
return False
139+
if new_files:
140+
gen_paths(fuzz_dir, cov_paths, new_files[0], cargs)
141+
else:
142+
rv = False
143+
break
143144

144145
def_dir = cargs.afl_fuzzing_dir + '/cov'
145146

146-
for ext in ['diff', 'lcov', 'web']:
147-
checkdir = "%s/%s" % (def_dir, ext)
148-
if not is_dir(checkdir):
149-
os.mkdir(checkdir)
150-
151147
# run initial command
152148
lcov_opts = ''
153149
if cargs.enable_branch_coverage:
@@ -165,8 +161,9 @@ def process_afl_test_cases(cargs):
165161
for index, f in enumerate(afl_files):
166162
curr_cycle = get_cycle_num(index, cargs)
167163

168-
logr("[+] AFL test case: %s (%d / %d), cycle: %d" % (os.path.basename(f), index + 1, len(afl_files),
169-
curr_cycle), cov_paths['log_file'], cargs)
164+
logr("[+] AFL test case: %s (%d / %d), cycle: %d" % \
165+
(os.path.basename(f), index + 1, len(afl_files),
166+
curr_cycle), cov_paths['log_file'], cargs)
170167

171168
if cargs.coverage_cmd:
172169
# execute the command to generate code coverage stats
@@ -333,6 +330,7 @@ def process_afl_test_cases(cargs):
333330
logr("[+] afl-fuzz appears to be stopped...",
334331
cov_paths['log_file'], cargs)
335332
break
333+
### only go once through the loop unless we are in --live mode
336334
else:
337335
break
338336

0 commit comments

Comments
 (0)