Skip to content

Fuzzing with Atheris; damaged archives never raise - #11

Closed
petecleary wants to merge 1 commit into
mainfrom
fuzz/atheris
Closed

petecleary wants to merge 1 commit into
mainfrom
fuzz/atheris

Conversation

@petecleary

@petecleary petecleary commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Coverage-guided fuzzing of the open-and-search path, the Python counterpart of the TypeScript Reader's Jazzer.js targets.

Target Input
fuzz/open_search.py Archive bytes, read with read_package
fuzz/package_files.py One file of a valid package (structure-procedure) replaced, read through a host source

Seeds come from moca-spec's corpus at the same ref as test.yml (v0.6.0). 60 seconds per target on pull requests, 30 minutes nightly, with the corpus kept between nightly runs. Atheris 3.1.0 is installed hash-checked from fuzz/requirements.txt, apart from uv.lock; Dependabot watches it with a 7-day cooldown.

Bugs found and fixed. read_package raised on three kinds of damaged archive instead of reporting them:

Input Before Now
Local header not where the central directory says ValueError: negative seek value P002
Encrypted entry RuntimeError P002
Entry needing a newer zip version than zipfile reads NotImplementedError T003

Each has a test in tests/test_archive_robustness.py that fails without the fix. The reference Reader gives T003 for the first and P002 for the third: both refuse the package, with different codes, because the zip libraries differ.

Local results: 250 tests pass (1 skipped); ruff, mypy and actionlint clean; after the fixes, 8 minutes on the archive target and 5 on the files target found nothing more.

Two targets, seeded from moca-spec's corpus: archive bytes, and one file of a
valid package replaced. 60 seconds per target on pull requests, 30 minutes
nightly, with the corpus kept between nightly runs.

Fuzzing found read_package raising on damaged archives. A local header not
where the central directory says, or an encrypted entry, is now P002; an
entry needing a newer zip version than zipfile reads rejects the archive
(T003). Tests for each.
@petecleary

Copy link
Copy Markdown
Contributor Author

This work continues in 0.8.0

@petecleary petecleary closed this Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant