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

Fix fuzz_repo False Positive With a Refactor to Improve Effectiveness & Efficiency #1317

Merged
merged 1 commit into from
May 16, 2024

Conversation

DaveLak
Copy link
Contributor

@DaveLak DaveLak commented May 16, 2024

Sorry for the churn on this test; filesystem I/O makes for slow feedback when trying to test locally.


Anyway, the issues listed below are addressed in this PR by simplifying the test harness implementation. The result being significantly improved fuzzing coverage and slightly improved execution speed.

Prior to the changes introduced here, the implementation of fuzz_repo had several issues:

  1. repo.stage() was not called before the first repo.do_commit() call
  2. When repo.stage() was eventually called, the argument it was passed was incorrect (a list of absolute paths instead of relative to the repo dir) causing a ValueError that broke the fuzzer runs. This was hidden during the initial local testing because of point 3 below.
  3. Inefficient consumption of the fuzzer provided data resulted in the input bytes being exhausted early in the TestOneInput execution until the fuzzer was able to generate a corpus large enough to satisfy all of the Consume* calls.

Other changes:

  • EnhancedFuzzedDataProvider.ConsumeRandomString now accepts an argument to optionally exclude unicode surrogates from the returned string (useful for places where they will always raise an exception like most filesystem operations.)
  • Adds new fuzzing engine recommended dictionary entries (now that the test is effective enough to generate recommendations.)

Closes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=69054

@DaveLak DaveLak requested a review from jelmer as a code owner May 16, 2024 08:43
Prior to the changes introduced here, the implementation of `fuzz_repo`
had several issues:

1. `repo.stage()` was not called before the first `repo.do_commit()`
  call
2. When `repo.stage()` was eventually called, the argument it was passed
   was incorrect (a list of absolute paths instead of relative to the
   repo dir) causing a `ValueError` that broke the fuzzer runs. This was
   hidden during the initial local testing because of point 3 below.
3. Inefficient consumption of the fuzzer provided data resulted in the
   input bytes being exhausted early in the `TestOneInput` execution
   until the fuzzer was able to generate a corpus large enough to
   satisfy all of the `Consume*`  calls.

The issues listed above are addressed here by simplifying the test
harness implementation. The result being significanly improved fuzzing
coverage and slightly improved execution speed.

Other changes:

- `EnhancedFuzzedDataProvider.ConsumeRandomString` now accepts an
  argument to optionally exclude unicode surrogates from the returned
  string (useful for places where they will always raise an exception
  like most filesystem operations.)
- Adds new fuzzing engine recommended dictionary entries (now that the
  test is effective enough to generate recommendations.)

Closes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=69054
@DaveLak DaveLak force-pushed the refactor-fuzz-repo branch from 766d9db to 6d41365 Compare May 16, 2024 09:07
@jelmer jelmer merged commit ac01c63 into jelmer:master May 16, 2024
19 of 22 checks passed
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