Annotation 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
    Modifier and Type
    Required Element
    Description
    Specifies supplier methods that generate values for fuzzing the annotated method or type.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Defines the scope of the annotation.
    double
    This ValuePool will be used with probability p by the mutator responsible for fitting types.
  • Element Details

    • value

      String[] value
      Specifies supplier methods that generate values for fuzzing the annotated method or type. The specified supplier methods must be static and return a Stream <?> 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 p
      This ValuePool will be used with probability p by the mutator responsible for fitting types.
      Default:
      0.1
    • constraint

      String constraint
      Defines the scope of the annotation. Possible values are defined in PropertyConstraint. By default it's RECURSIVE.
      Default:
      "JAZZER_PROPERTY_CONSTRAINT_RECURSIVE"