Skip to content

Commit

Permalink
Allow projects to always upload crashes even if they are "unreportabl…
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanmetzman authored Dec 13, 2021
1 parent 545a073 commit e96a5f8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions infra/cifuzz/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def __init__(self):

self.report_timeouts = environment.get_bool('REPORT_TIMEOUTS', False)
self.report_ooms = environment.get_bool('REPORT_OOMS', True)
self.upload_all_crashes = environment.get_bool('UPLOAD_ALL_CRASHES', False)

# TODO(metzman): Fix tests to create valid configurations and get rid of
# CIFUZZ_TEST here and in presubmit.py.
Expand Down
20 changes: 11 additions & 9 deletions infra/cifuzz/fuzz_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,17 @@ def fuzz(self, batch=False):
crash = result.crashes[0]
logging.info('Fuzzer: %s. Detected bug.', self.target_name)

if self.is_crash_reportable(crash.input_path,
crash.reproduce_args,
batch=batch):
# We found a bug in the fuzz target and we will report it.
saved_path = self._save_crash(crash)
return FuzzResult(saved_path, result.logs, self.latest_corpus_path)

# We found a bug but we won't report it.
return FuzzResult(None, None, self.latest_corpus_path)
is_reportable = self.is_crash_reportable(crash.input_path,
crash.reproduce_args,
batch=batch)
if is_reportable or self.config.upload_all_crashes:
fuzzer_logs = result.logs
testcase_path = self._save_crash(crash)
else:
fuzzer_logs = None
testcase_path = None

return FuzzResult(testcase_path, fuzzer_logs, self.latest_corpus_path)

def free_disk_if_needed(self, delete_fuzz_target=True):
"""Deletes things that are no longer needed from fuzzing this fuzz target to
Expand Down
2 changes: 1 addition & 1 deletion infra/cifuzz/run_fuzzers.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def run_fuzz_targets(self):

fuzzers_left_to_run -= 1
if not result.testcase or not result.stacktrace:
logging.info('Fuzzer %s finished running without crashes.',
logging.info('Fuzzer %s finished running without reportable crashes.',
target.target_name)
continue

Expand Down

0 comments on commit e96a5f8

Please sign in to comment.