Unable to use Jazzer due to compilation error

15 Views Asked by At

I am new to fuzz testing. I tried jazzer to fuzz test by setting it up in my windows PC. I have the required "java_standalone.jar" in the same path with the code I am trying to test.

Here is the code:

public class DivisionExample {
    public static void main(String[] args) {
        System.out.println("The division is "+divide(4,0));
    }
 
    public static int divide(int a, int b) {
        if (b == 0) { 
            throw new IllegalArgumentException("The b input value must be >0");
        }
        int result = a/b;
        return result;
    }
}

And here is the jazzer harness

public class DivisionExampleFuzzer
{
    public static void fuzzerTestOneInput(FuzzedDataProvider data) {
        int a = data.consumeInt();
        int b = data.consumeInt();
        DivisionExample.divide(a,b);
    }
}

This is the error I am getting. i tried different ways to run the "javac" but it is not working.

javac -cp jazzer_standalone.jar:DivisionExample.jar DivisionExampleFuzzer.java
DivisionExampleFuzzer.java:3: error: cannot find symbol
   public static void fuzzerTestOneInput(FuzzedDataProvider data) {
                                         ^
 symbol:   class FuzzedDataProvider
 location: class DivisionExampleFuzzer
DivisionExampleFuzzer.java:6: error: cannot find symbol
       DivisionExample.divide(a,b);
       ^
 symbol:   variable DivisionExample
 location: class DivisionExampleFuzzer
2 errors
0

There are 0 best solutions below