CodeIntelligenceTesting / jazzer

Coverage-guided, in-process fuzzing for the JVM
https://code-intelligence.com
Other
1k stars 134 forks source link

Set the -max_len argument in junit #885

Open svdbtno opened 9 months ago

svdbtno commented 9 months ago

We want to have more data available in the FuzzedDataProvider. Currently we only receive very few bytes. We would like to receive more therefore we want to set the -max_len for libFuzzer. We currently get the following info log= INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes.

We tried setting it using the following command: JAZZER_FUZZ=1 mvn test -Dtest=ourTest#testMethod -Djazzer.internal.args.0="-max_len=50000" and we tried JAZZER_FUZZ=1 mvn test -Dtest=ourTest#testMethod -Dmax_len=50000 both did not work. Any suggestions?

PS. jazzer.internal.args.0 is used, since we saw the following: https://github.com/CodeIntelligenceTesting/jazzer/blob/1f2bdf936b6856b6ecff6a79f5dfd4085db1adb1/src/main/java/com/code_intelligence/jazzer/junit/FuzzTestExecutor.java#L270-L280

yawkat commented 8 months ago

the junit integration in general is missing a bunch of features that make it unusable for some of our fuzz targets. e.g. setting the instrumented classes or the corpus.

It would be nice to have some generic, non-internal way of adding jazzer parameters to a FuzzTest.

ramzanzan commented 7 months ago

Add into junit-platform.properties lines: jazzer.internal.arg.0=fakeArgv jazzer.internal.arg.1=-lib_fuzzer_opt1=val1 jazzer.internal.arg.2=-lib_fuzzer_opt2=val2

ghost commented 6 months ago

@yawkat - Good feedback! Sorry for our late reply. We made some strategic changes and pivoted to working on Jazzer updates as closed source only. We can give you more detailed support on a call/over email and try other options for you. Just need to understand in detail what you are trying to achieve, and we can give the best options to solve. Ping me? david[dot]merian [at] code-intelligence[dot]com

ghost commented 6 months ago

@ramzanzan and @svdbtno - same as I wrote to @yawkat above, happy to chat with you all too about your specific wishes/challenges!

ksiv commented 2 months ago

Add into junit-platform.properties lines: jazzer.internal.arg.0=fakeArgv jazzer.internal.arg.1=-lib_fuzzer_opt1=val1 jazzer.internal.arg.2=-lib_fuzzer_opt2=val2

@svdbtno , @ramzanzan, thank you my friends, you have made my day. Here is my reworked option just in case someone needs it outside platform properties file:

   @BeforeAll
   public void setUp() {
      System.setProperty("jazzer.internal.arg.0","-fakeArgv");
      System.setProperty("jazzer.internal.arg.1","-max_len=8192");
      System.setProperty("jazzer.internal.arg.2","-print_final_stats=1");

      }