BREAKING feat: use mutation framework for single-byte[] fuzz tests#1034
Open
BREAKING feat: use mutation framework for single-byte[] fuzz tests#1034
Conversation
a75bb07 to
4c671e1
Compare
There was a problem hiding this comment.
Pull request overview
This pull request enables the mutation framework by default for fuzz tests with a single byte[] parameter, resolving issue #1022 where mutation framework annotations like @WithLength were being ignored for such tests. Previously, single byte[] parameter fuzz tests were automatically treated as "classic" mode tests, but now they use the mutation framework unless JAZZER_MUTATOR_FRAMEWORK=false is explicitly set.
Changes:
- Modified FuzzTargetRunner to remove the check that forced single byte[] parameters into classic mode
- Added
@NotNullannotations to byte[] parameters in fuzz tests that use the mutation framework - Updated build configurations to test fuzzers in both classic and mutation framework modes
- Added null checks in tests that run in both modes (LongStringFuzzer, KotlinStringCompareFuzzer)
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/com/code_intelligence/jazzer/driver/FuzzTargetRunner.java | Removed check that forced byte[] parameters into classic mode |
| src/main/java/com/code_intelligence/jazzer/mutation/mutator/lang/PrimitiveArrayMutatorFactory.java | Added special default max length for byte arrays (4096 vs 1000) to match libFuzzer defaults |
| tests/src/test/java/com/example/StringCompareFuzzer.java | Added @NotNull annotation to byte[] parameter |
| tests/src/test/java/com/example/OfflineInstrumentedFuzzer.java | Added @NotNull annotation to byte[] parameter |
| tests/src/test/java/com/example/ObjectEqualsStringFuzzer.java | Added @NotNull annotation to byte[] parameter |
| tests/src/test/java/com/example/LongStringFuzzer.java | Added null check for mutation framework compatibility |
| tests/src/test/java/com/example/KotlinStringCompareFuzzer.kt | Changed parameter to nullable ByteArray? and added null check |
| tests/BUILD.bazel | Duplicated tests to run in both classic and mutation framework modes, updated crash hashes |
| src/test/java/com/code_intelligence/jazzer/junit/BUILD.bazel | Added JAZZER_MUTATOR_FRAMEWORK=false to tests that should remain in classic mode |
| src/test/java/com/code_intelligence/jazzer/driver/BUILD.bazel | Added JAZZER_MUTATOR_FRAMEWORK=false to FuzzTargetRunnerTest |
| sanitizers/src/test/java/com/example/BUILD.bazel | Duplicated ObjectInputStreamDeserialization test for both modes |
| examples/src/main/java/com/example/*.java | Added @NotNull annotations to byte[] parameters in example fuzzers |
| examples/junit/src/test/java/com/example/*.java | Added @NotNull annotations to byte[] parameters in JUnit example tests |
| examples/BUILD.bazel | Duplicated example tests to run in both classic and mutation framework modes |
| examples/junit/src/test/java/com/example/BUILD.bazel | Duplicated JUnit example tests for both modes, updated crash hashes for CommandLineFuzzTest |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...in/java/com/code_intelligence/jazzer/mutation/mutator/lang/PrimitiveArrayMutatorFactory.java
Outdated
Show resolved
Hide resolved
4c671e1 to
121551d
Compare
121551d to
2cae4d1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fuzz tests with a single
byte[]parameter now also use the mutation framework by default.This allows Jazzer annotations to be used in this setting as well.
To use classsic mode, set environment variable
JAZZER_MUTATOR_FRAMEWORKto 0.See discussion in #1022 for more background.