Class CannedFuzzedDataProvider

java.lang.Object
com.code_intelligence.jazzer.api.CannedFuzzedDataProvider
All Implemented Interfaces:
FuzzedDataProvider

public final class CannedFuzzedDataProvider extends Object implements FuzzedDataProvider
Replays recorded FuzzedDataProvider invocations that were executed while fuzzing. Note: This class is only meant to be used by Jazzer's generated reproducers.
  • Constructor Details

    • CannedFuzzedDataProvider

      public CannedFuzzedDataProvider(String can)
  • Method Details

    • create

      public static CannedFuzzedDataProvider create(List<Object> objects)
    • consumeBoolean

      public boolean consumeBoolean()
      Description copied from interface: FuzzedDataProvider
      Consumes a boolean from the fuzzer input.
      Specified by:
      consumeBoolean in interface FuzzedDataProvider
      Returns:
      a boolean
    • consumeBooleans

      public boolean[] consumeBooleans(int maxLength)
      Description copied from interface: FuzzedDataProvider
      Consumes a boolean array from the fuzzer input.

      The array will usually have length length, but might be shorter if the fuzzer input is not sufficiently long.

      Specified by:
      consumeBooleans in interface FuzzedDataProvider
      Parameters:
      maxLength - the maximum length of the array
      Returns:
      a boolean array of length at most length
    • consumeByte

      public byte consumeByte()
      Description copied from interface: FuzzedDataProvider
      Consumes a byte from the fuzzer input.
      Specified by:
      consumeByte in interface FuzzedDataProvider
      Returns:
      a byte
    • consumeByte

      public byte consumeByte(byte min, byte max)
      Description copied from interface: FuzzedDataProvider
      Consumes a byte between min and max from the fuzzer input.
      Specified by:
      consumeByte in interface FuzzedDataProvider
      Parameters:
      min - the inclusive lower bound on the returned value
      max - the inclusive upper bound on the returned value
      Returns:
      a byte in the range [min, max]
    • consumeShort

      public short consumeShort()
      Description copied from interface: FuzzedDataProvider
      Consumes a short from the fuzzer input.
      Specified by:
      consumeShort in interface FuzzedDataProvider
      Returns:
      a short
    • consumeShort

      public short consumeShort(short min, short max)
      Description copied from interface: FuzzedDataProvider
      Consumes a short between min and max from the fuzzer input.
      Specified by:
      consumeShort in interface FuzzedDataProvider
      Parameters:
      min - the inclusive lower bound on the returned value
      max - the inclusive upper bound on the returned value
      Returns:
      a short in the range [min, max]
    • consumeShorts

      public short[] consumeShorts(int maxLength)
      Description copied from interface: FuzzedDataProvider
      Consumes a short array from the fuzzer input.

      The array will usually have length length, but might be shorter if the fuzzer input is not sufficiently long.

      Specified by:
      consumeShorts in interface FuzzedDataProvider
      Parameters:
      maxLength - the maximum length of the array
      Returns:
      a short array of length at most length
    • consumeInt

      public int consumeInt()
      Description copied from interface: FuzzedDataProvider
      Consumes an int from the fuzzer input.
      Specified by:
      consumeInt in interface FuzzedDataProvider
      Returns:
      an int
    • consumeInt

      public int consumeInt(int min, int max)
      Description copied from interface: FuzzedDataProvider
      Consumes an int between min and max from the fuzzer input.
      Specified by:
      consumeInt in interface FuzzedDataProvider
      Parameters:
      min - the inclusive lower bound on the returned value
      max - the inclusive upper bound on the returned value
      Returns:
      an int in the range [min, max]
    • consumeInts

      public int[] consumeInts(int maxLength)
      Description copied from interface: FuzzedDataProvider
      Consumes an int array from the fuzzer input.

      The array will usually have length length, but might be shorter if the fuzzer input is not sufficiently long.

      Specified by:
      consumeInts in interface FuzzedDataProvider
      Parameters:
      maxLength - the maximum length of the array
      Returns:
      an int array of length at most length
    • consumeLong

      public long consumeLong()
      Description copied from interface: FuzzedDataProvider
      Consumes a long from the fuzzer input.
      Specified by:
      consumeLong in interface FuzzedDataProvider
      Returns:
      a long
    • consumeLong

      public long consumeLong(long min, long max)
      Description copied from interface: FuzzedDataProvider
      Consumes a long between min and max from the fuzzer input.
      Specified by:
      consumeLong in interface FuzzedDataProvider
      Parameters:
      min - the inclusive lower bound on the returned value
      max - the inclusive upper bound on the returned value
      Returns:
      a long in the range @{code [min, max]}
    • consumeLongs

      public long[] consumeLongs(int maxLength)
      Description copied from interface: FuzzedDataProvider
      Consumes a long array from the fuzzer input.

      The array will usually have length length, but might be shorter if the fuzzer input is not sufficiently long.

      Specified by:
      consumeLongs in interface FuzzedDataProvider
      Parameters:
      maxLength - the maximum length of the array
      Returns:
      a long array of length at most length
    • consumeFloat

      public float consumeFloat()
      Description copied from interface: FuzzedDataProvider
      Consumes a float from the fuzzer input.
      Specified by:
      consumeFloat in interface FuzzedDataProvider
      Returns:
      a float that may have a special value (e.g. a NaN or infinity)
    • consumeRegularFloat

      public float consumeRegularFloat()
      Description copied from interface: FuzzedDataProvider
      Consumes a regular float from the fuzzer input.
      Specified by:
      consumeRegularFloat in interface FuzzedDataProvider
      Returns:
      a float that is not a special value (e.g. not a NaN or infinity)
    • consumeRegularFloat

      public float consumeRegularFloat(float min, float max)
      Description copied from interface: FuzzedDataProvider
      Consumes a regular float between min and max from the fuzzer input.
      Specified by:
      consumeRegularFloat in interface FuzzedDataProvider
      Returns:
      a float in the range [min, max]
    • consumeProbabilityFloat

      public float consumeProbabilityFloat()
      Description copied from interface: FuzzedDataProvider
      Consumes a float between 0.0 and 1.0 (inclusive) from the fuzzer input.
      Specified by:
      consumeProbabilityFloat in interface FuzzedDataProvider
      Returns:
      a float in the range [0.0, 1.0]
    • consumeDouble

      public double consumeDouble()
      Description copied from interface: FuzzedDataProvider
      Consumes a double from the fuzzer input.
      Specified by:
      consumeDouble in interface FuzzedDataProvider
      Returns:
      a double that may have a special value (e.g. a NaN or infinity)
    • consumeRegularDouble

      public double consumeRegularDouble(double min, double max)
      Description copied from interface: FuzzedDataProvider
      Consumes a regular double between min and max from the fuzzer input.
      Specified by:
      consumeRegularDouble in interface FuzzedDataProvider
      Returns:
      a double in the range [min, max]
    • consumeRegularDouble

      public double consumeRegularDouble()
      Description copied from interface: FuzzedDataProvider
      Consumes a regular double from the fuzzer input.
      Specified by:
      consumeRegularDouble in interface FuzzedDataProvider
      Returns:
      a double that is not a special value (e.g. not a NaN or infinity)
    • consumeProbabilityDouble

      public double consumeProbabilityDouble()
      Description copied from interface: FuzzedDataProvider
      Consumes a double between 0.0 and 1.0 (inclusive) from the fuzzer input.
      Specified by:
      consumeProbabilityDouble in interface FuzzedDataProvider
      Returns:
      a double in the range [0.0, 1.0]
    • consumeChar

      public char consumeChar()
      Description copied from interface: FuzzedDataProvider
      Consumes a char from the fuzzer input.
      Specified by:
      consumeChar in interface FuzzedDataProvider
    • consumeChar

      public char consumeChar(char min, char max)
      Description copied from interface: FuzzedDataProvider
      Consumes a char between min and max from the fuzzer input.
      Specified by:
      consumeChar in interface FuzzedDataProvider
      Parameters:
      min - the inclusive lower bound on the returned value
      max - the inclusive upper bound on the returned value
      Returns:
      a char in the range [min, max]
    • consumeCharNoSurrogates

      public char consumeCharNoSurrogates()
      Description copied from interface: FuzzedDataProvider
      Consumes a char from the fuzzer input that is never a UTF-16 surrogate character.
      Specified by:
      consumeCharNoSurrogates in interface FuzzedDataProvider
    • consumeAsciiString

      public String consumeAsciiString(int maxLength)
      Description copied from interface: FuzzedDataProvider
      Consumes an ASCII-only String from the fuzzer input.

      The returned string may be of any length between 0 and maxLength, even if there is more fuzzer input available.

      Specified by:
      consumeAsciiString in interface FuzzedDataProvider
      Parameters:
      maxLength - the maximum length of the string
      Returns:
      a String of length between 0 and maxLength (inclusive) that contains only ASCII characters
    • consumeString

      public String consumeString(int maxLength)
      Description copied from interface: FuzzedDataProvider
      Consumes a String from the fuzzer input.

      The returned string may be of any length between 0 and maxLength, even if there is more fuzzer input available.

      Specified by:
      consumeString in interface FuzzedDataProvider
      Parameters:
      maxLength - the maximum length of the string
      Returns:
      a String of length between 0 and maxLength (inclusive)
    • consumeRemainingAsAsciiString

      public String consumeRemainingAsAsciiString()
      Description copied from interface: FuzzedDataProvider
      Consumes the remaining fuzzer input as an ASCII-only String.

      Note: After calling this method, further calls to methods of this interface will return fixed values only.

      Specified by:
      consumeRemainingAsAsciiString in interface FuzzedDataProvider
      Returns:
      a String that contains only ASCII characters
    • consumeRemainingAsString

      public String consumeRemainingAsString()
      Description copied from interface: FuzzedDataProvider
      Consumes the remaining fuzzer input as a String.

      Note: After calling this method, further calls to methods of this interface will return fixed values only.

      Specified by:
      consumeRemainingAsString in interface FuzzedDataProvider
      Returns:
      a String
    • consumeBytes

      public byte[] consumeBytes(int maxLength)
      Description copied from interface: FuzzedDataProvider
      Consumes a byte array from the fuzzer input.

      The array will usually have length length, but might be shorter if the fuzzer input is not sufficiently long.

      Specified by:
      consumeBytes in interface FuzzedDataProvider
      Parameters:
      maxLength - the maximum length of the array
      Returns:
      a byte array of length at most length
    • consumeRemainingAsBytes

      public byte[] consumeRemainingAsBytes()
      Description copied from interface: FuzzedDataProvider
      Consumes the remaining fuzzer input as a byte array.

      Note: After calling this method, further calls to methods of this interface will return fixed values only.

      Specified by:
      consumeRemainingAsBytes in interface FuzzedDataProvider
      Returns:
      a byte array
    • remainingBytes

      public int remainingBytes()
      Description copied from interface: FuzzedDataProvider
      Returns the number of unconsumed bytes in the fuzzer input.
      Specified by:
      remainingBytes in interface FuzzedDataProvider
      Returns:
      the number of unconsumed bytes in the fuzzer input