Skip to content

Commit

Permalink
Update Known Exception Handling in fuzz_repo to Prevent False Posit…
Browse files Browse the repository at this point in the history
…ives (#1316)

The `fuzz_repo` fuzz target is crashing the fuzzer because of a known
exception case where the time ofsets in commit messages can raise a
`ValueError`, which is not an interesting in the context of fuzzing.

Closes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=69045
  • Loading branch information
jelmer committed May 15, 2024
2 parents fc76512 + e0c28da commit 2f7229b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fuzzing/fuzz-targets/fuzz_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

with atheris.instrument_imports():
# We instrument `test_utils` as well, so it doesn't block coverage analysis in Fuzz Introspector:
from test_utils import EnhancedFuzzedDataProvider
from test_utils import EnhancedFuzzedDataProvider, is_expected_exception

from dulwich.repo import (
InvalidUserIdentity,
Expand Down Expand Up @@ -42,6 +42,9 @@ def TestOneInput(data):
)
except InvalidUserIdentity:
return -1
except ValueError as e:
if is_expected_exception(["Unable to handle non-minute offset"], e):
return -1

for file_path in file_paths:
with open(file_path, "wb") as f:
Expand Down

0 comments on commit 2f7229b

Please sign in to comment.