What is the Jazzer Mutation Framework?
mainThe Mutation Framework allows Jazzer fuzz tests to accept multiple parameters of various primitive and object types, rather than being restricted to a single FuzzedDataProvider or byte[].
Instead of manually parsing bytes to create complex objects, the framework uses type information to directly generate and mutate valid inputs. This makes fuzz tests for complex data structures more efficient and less cumbersome.
Key Characteristics:
- Extensible and Composable: Type-specific mutation logic is encapsulated in dedicated mutators that automatically compose for complex types (e.g., a
Listmutator uses the mutator for its element type). - Stability: The framework integrates with the underlying fuzzing engine to ensure that changes to mutation logic do not invalidate existing findings or corpus entries.
- Automatic Usage: If a fuzz function expects a single
FuzzedDataProviderorbyte[]parameter, the mutation framework is not used. To trigger the framework, use supported types as parameters.
The framework is located in the com.code_intelligence.jazzer.mutation package.
record SimpleTypesRecord(boolean bar, int baz) {
}
@FuzzTest
public void testSimpleTypeRecord(SimpleTypesRecord record) {
doSomethingWithRecord(record);
}