Skip to content

Commit

Permalink
Improve logging for afl-showmap execution. (#2210)
Browse files Browse the repository at this point in the history
  • Loading branch information
inferno-chromium authored Jan 26, 2021
1 parent ab77a57 commit 6a2c07e
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/python/bot/fuzzers/afl/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,14 +1055,18 @@ def get_file_features(self, input_file_path, showmap_args):
if not os.path.exists(self.showmap_output_path):
if not self.showmap_no_output_logged:
self.showmap_no_output_logged = True
logs.log_error(
('afl-showmap didn\'t output any coverage. Command: {0}\n'
'Return code: {1}\n'
'Time executed: {2}\n'
'Output: {3}').format(
showmap_result.command, showmap_result.return_code,
showmap_result.time_executed, showmap_result.output))

logs.log_error(('afl-showmap didn\'t output any coverage for '
'file {file_path} ({file_size} bytes).\n'
'Command: {command}\n'
'Return code: {return_code}\n'
'Time executed: {time_executed}\n'
'Output: {output}').format(
file_path=input_file_path,
file_size=os.path.getsize(input_file_path),
command=showmap_result.command,
return_code=showmap_result.return_code,
time_executed=showmap_result.time_executed,
output=showmap_result.output))
return None, True

showmap_output = engine_common.read_data_from_file(self.showmap_output_path)
Expand All @@ -1071,6 +1075,9 @@ def get_file_features(self, input_file_path, showmap_args):
for match in re.finditer(self.SHOWMAP_REGEX, showmap_output):
d = match.groupdict()
features.add((int(d['guard']), int(d['hit_count'])))
logs.log('afl-showmap succeedded for '
'file {file_path}: {features} features'.format(
file_path=input_file_path, features=len(features)))
return frozenset(features), False

def merge_corpus(self):
Expand Down

0 comments on commit 6a2c07e

Please sign in to comment.