fix: don't apply Bean factories for proto enums#963
Merged
simonresch merged 1 commit intomainfrom Oct 13, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug where using full bean factories for protobuf enum types could trigger deeply nested mutator construction attempts, leading to invalid mutators for complex protobuf parameters. The fix replaces the full original factory with a simplified factory that only handles repeated or nullable enums when processing enum types.
- Simplified enum mutator factory construction to prevent invalid mutator creation
- Updated Bazel visibility rules to allow proper package dependencies
- Added regression test for complex protobuf parameter scenarios
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/com/code_intelligence/jazzer/mutation/mutator/proto/BuilderMutatorFactory.java | Core fix replacing full factory with simplified enum-specific factory |
| src/test/java/com/code_intelligence/jazzer/mutation/ArgumentsMutatorTest.java | Regression test for protobuf enum handling with complex parameters |
| src/main/java/com/code_intelligence/jazzer/mutation/mutator/proto/BUILD.bazel | Added dependencies for collection and lang mutators |
| src/main/java/com/code_intelligence/jazzer/mutation/mutator/lang/BUILD.bazel | Updated visibility to allow subpackage access |
| src/main/java/com/code_intelligence/jazzer/mutation/mutator/collection/BUILD.bazel | Updated visibility to allow subpackage access |
| src/test/java/com/code_intelligence/jazzer/mutation/mutator/proto/BUILD.bazel | Expanded visibility for test proto dependencies |
| src/test/java/com/code_intelligence/jazzer/mutation/BUILD.bazel | Added proto dependencies for test compilation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/main/java/com/code_intelligence/jazzer/mutation/mutator/proto/BuilderMutatorFactory.java
Outdated
Show resolved
Hide resolved
111270d to
0fd6373
Compare
0fd6373 to
92e699e
Compare
Using the full original factory to construct a mutator for protobuf enum types would trigger a deeply nested mutator construction attempt on the EnumValueDescriptor class using e.g. the `CachedConstructorMutatorFactory`. While this still ended up at the dedicated enum mutator for most cases, for complex protobuf parameters it could lead to the construction of invalid mutators. At the point where an enum type is reached we now use a simplified factory instead that only deals with repeated or nullable enums.
92e699e to
bddff3d
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.
The following fuzz test signature would fail during printing of the constructed mutator
Using the full original factory to construct a mutator for protobuf enum types would trigger a deeply nested mutator construction attempt on the EnumValueDescriptor class using e.g. the
CachedConstructorMutatorFactory. While this still ended up at the dedicated enum mutator for most cases, for complex protobuf parameters it could lead to the construction of invalid mutators.At the point where an enum type is reached we now use a simplified factory instead that only deals with repeated or nullable enums.