From aa45d565ba34b87d9a183cbc94b4968cae743c27 Mon Sep 17 00:00:00 2001 From: katherine-hough <32645020+katherine-hough@users.noreply.github.com> Date: Fri, 27 Oct 2023 15:17:41 -0400 Subject: [PATCH] * Started automatically escaping :'s in java options for Jazzer --- .../java/edu/neu/ccs/prl/meringue/JazzerFramework.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/meringue-jazzer-extension/src/main/java/edu/neu/ccs/prl/meringue/JazzerFramework.java b/meringue-jazzer-extension/src/main/java/edu/neu/ccs/prl/meringue/JazzerFramework.java index ba2f073..1fb8c8d 100644 --- a/meringue-jazzer-extension/src/main/java/edu/neu/ccs/prl/meringue/JazzerFramework.java +++ b/meringue-jazzer-extension/src/main/java/edu/neu/ccs/prl/meringue/JazzerFramework.java @@ -8,6 +8,7 @@ import java.nio.file.Files; import java.nio.file.StandardCopyOption; import java.util.*; +import java.util.stream.Collectors; public final class JazzerFramework implements FuzzFramework { private File outputDir; @@ -117,7 +118,7 @@ private List createCommand(CampaignConfiguration config, Properties fram command.add("--keep_going=" + Integer.MAX_VALUE); command.add("--reproducer_path=" + reproducerDir.getAbsolutePath()); if (!config.getJavaOptions().isEmpty()) { - command.add("--jvm_args=" + String.join(File.pathSeparator, config.getJavaOptions())); + command.add("--jvm_args=" + String.join(File.pathSeparator, escapeJavaOptions(config.getJavaOptions()))); } String argLine = frameworkArguments.getProperty("argLine"); if (argLine != null && !argLine.isEmpty()) { @@ -132,6 +133,12 @@ private List createCommand(CampaignConfiguration config, Properties fram return command; } + private static List escapeJavaOptions(List javaOptions) { + return javaOptions.stream() + .map(s -> s.replace(":", "\\:")) + .collect(Collectors.toList()); + } + private static File getJazzerResource(File outputDir, String resourceName) throws IOException { String resourcePathPrefix; if (SystemUtils.IS_OS_MAC) {