Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fuzz test archive round trip and reading #30

Merged
merged 1 commit into from
Mar 26, 2024
Merged

Conversation

niklasf
Copy link
Contributor

@niklasf niklasf commented Mar 25, 2024

This adds a fuzz target to be run via cargo +nightly fuzz run roundtrip.

Currently the archive builder does not have a strategy to handle invalid inputs, so I have manually excluded them for now and marked them with TODO. For example, values that are too large could be rejected by the builder, or simply truncated like the command line ar tool does (#29).

Even so, the fuzzer very quickly finds round trip errors. Example invocation:

$ cargo +nightly fuzz run roundtrip
SUMMARY: libFuzzer: deadly signal
[...]
$ cargo +nightly fuzz tmin roundtrip artifacts/roundtrip/crash-ac1fb9c71264dadbf7b173c19df553a58ade3a5d
[...]
thread 'roundtrip' panicked at fuzz_targets/roundtrip.rs:104:25:
read entry: unexpected EOF in the middle of archive entry header with Model { [...], data: [97, 97], [...] }
[...]

Update: That was due to long identifiers. Now appears to be a working a working baseline.

@niklasf niklasf force-pushed the fuzz branch 5 times, most recently from ef2cbb1 to f74eaf8 Compare March 25, 2024 23:03
@mdsteele
Copy link
Owner

Thanks, this would be great to have. Looks like the lint error was preexisting; if you sync the latest changes it should be fixed now.

@niklasf niklasf changed the title fuzz test archive round trip fuzz test archive round trip and reading Mar 26, 2024
@niklasf
Copy link
Contributor Author

niklasf commented Mar 26, 2024

Rebased.

Also added coverage for the GNU builder and reading arbitrary bytes.

@mdsteele mdsteele merged commit a531aa7 into mdsteele:master Mar 26, 2024
4 checks passed
@mdsteele
Copy link
Owner

Thanks!

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.

2 participants