Annotation Interface ValuePool
@Target({METHOD,TYPE_USE})
@Retention(RUNTIME)
@IgnoreRecursiveConflicts
public @interface ValuePool
Provides values to user-selected mutator types to start fuzzing from.
This annotation can be applied to fuzz test methods and any parameter type or subtype. By
default, this annotation is propagated to all nested subtypes unless specified otherwise via the
constraint() attribute.
Example usage:
public class MyFuzzTargets {
static Stream<?> valuesVisibleByAllArgumentMutators() {
return Stream.of("example1", "example2", "example3", 1232187321, -182371);
}
static Stream<?> valuesVisibleOnlyByAnotherInput() {
return Stream.of("code-intelligence.com", "secret.url.1082h3u21ibsdsazuvbsa.com");
}
@ValuePool("valuesVisibleByAllArgumentMutators")
@FuzzTest
public void fuzzerTestOneInput(String input, @ValuePool("valuesVisibleOnlyByAnotherInput") String anotherInput) {
// Fuzzing logic here
}
}
In this example, the mutator for the String parameter input of the fuzz test method
fuzzerTestOneInput will be using the values returned by
valuesVisibleByAllArgumentMutators method during mutation, while the mutator for String
anotherInput will use values from both methods: from the method-level ValuePool
annotation that uses valuesVisibleByAllArgumentMutators and the parameter-level
ValuePool annotation that uses valuesVisibleOnlyByAnotherInput.-
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionDefines the scope of the annotation.doubleThisValuePoolwill be used with probabilitypby the mutator responsible for fitting types.
-
Element Details
-
value
String[] valueSpecifies supplier methods that generate values for fuzzing the annotated method or type. The specified supplier methods must be static and return aStream <?>of values. The values don't need to match the type of the annotated method or parameter. The mutation framework will extract only the values that are compatible with the target type. -
p
double pThisValuePoolwill be used with probabilitypby the mutator responsible for fitting types.- Default:
0.1
-
constraint
String constraintDefines the scope of the annotation. Possible values are defined inPropertyConstraint. By default it'sRECURSIVE.- Default:
"JAZZER_PROPERTY_CONSTRAINT_RECURSIVE"
-