aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorFabian Meumertzheim <meumertzheim@code-intelligence.com>2021-06-01 13:30:47 +0200
committerFabian Meumertzheim <fabian@meumertzhe.im>2021-06-01 14:17:12 +0200
commitda4c3b95347573d67893f872b4e9967c90ee4a3e (patch)
tree858c99227944f9e6d7e308960fd295cb9738337c /examples
parent67608415cf72efeebc1130d98aa01754ef0798c3 (diff)
downloadjazzer-api-da4c3b95347573d67893f872b4e9967c90ee4a3e.tar.gz
Add additional_jvm_args flag
In certain situations, such as OSS-Fuzz coverage reports, additional JVM args need to be specified on the command line after --jvm_args has already been used. Specifying --jvm_args again overrides the previous arguments rather than appending to them. This commit adds an additional flag for adding JVM args that will be emitted after the flags specified in --jvm_args.
Diffstat (limited to 'examples')
-rw-r--r--examples/BUILD.bazel1
-rw-r--r--examples/src/main/java/com/example/JpegImageParserFuzzer.java3
2 files changed, 3 insertions, 1 deletions
diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel
index df1e7832..b2d021d0 100644
--- a/examples/BUILD.bazel
+++ b/examples/BUILD.bazel
@@ -75,6 +75,7 @@ java_fuzz_target_test(
# processes. Quoting with both " and ' is necessary in this test since
# one level of quoting is lost when passing through jazzer_wrapper.sh
"--jvm_args=\"'-Dfoo=foo;-Dbar=bar'\"",
+ "--additional_jvm_args=\"'-Dbaz=baz'\"",
],
# The exit codes of the forked libFuzzer processes are not picked up correctly.
tags = ["broken-on-darwin"],
diff --git a/examples/src/main/java/com/example/JpegImageParserFuzzer.java b/examples/src/main/java/com/example/JpegImageParserFuzzer.java
index 6a36f8f1..84a1029a 100644
--- a/examples/src/main/java/com/example/JpegImageParserFuzzer.java
+++ b/examples/src/main/java/com/example/JpegImageParserFuzzer.java
@@ -24,7 +24,8 @@ import org.apache.commons.imaging.formats.jpeg.JpegImageParser;
public class JpegImageParserFuzzer {
public static void fuzzerInitialize() {
// Only used to verify that arguments are correctly passed down to child processes.
- if (System.getProperty("foo") == null || System.getProperty("bar") == null) {
+ if (System.getProperty("foo") == null || System.getProperty("bar") == null
+ || System.getProperty("baz") == null) {
// Exit the process with an exit code different from that for a finding.
System.err.println("ERROR: Did not pass all jvm_args to child process.");
System.exit(3);