jazzer icon indicating copy to clipboard operation
jazzer copied to clipboard

Set the -max_len argument in junit

Open svdbtno opened this issue 1 year ago • 5 comments

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

svdbtno avatar Nov 22 '23 13:11 svdbtno

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.

yawkat avatar Dec 19 '23 08:12 yawkat

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

ramzanzan avatar Jan 30 '24 18:01 ramzanzan

@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 avatar Feb 26 '24 11:02 ghost

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

ghost avatar Feb 26 '24 11:02 ghost

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");

      }

ksiv avatar Jun 16 '24 18:06 ksiv