Skip to content

Commit

Permalink
driver: Always include jazzer in argv[0]
Browse files Browse the repository at this point in the history
libFuzzer does print `argv[0]` when running on individual files.
  • Loading branch information
fmeum committed Mar 23, 2023
1 parent 10f7aea commit bf66576
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/com/code_intelligence/jazzer/Jazzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ private static void start(List<String> args) throws IOException, InterruptedExce
// is an unnecessary overhead.
final boolean spawnsSubprocesses = args.stream().anyMatch(
arg -> arg.startsWith("-fork=") || arg.startsWith("-jobs=") || arg.startsWith("-merge="));
String arg0 = spawnsSubprocesses ? prepareArgv0(new HashMap<>())
: "unused_report_a_bug_if_you_see_this";
// argv0 is printed by libFuzzer during reproduction, so have it contain "jazzer".
String arg0 = spawnsSubprocesses ? prepareArgv0(new HashMap<>()) : "jazzer";
args = Stream.concat(Stream.of(arg0), args.stream()).collect(toList());
exit(Driver.start(args, spawnsSubprocesses));
}
Expand Down Expand Up @@ -234,6 +234,8 @@ private static String prepareArgv0(Map<String, String> additionalEnvironment) th
String invocation = env.isEmpty() ? command : env + " " + command;
String launcherContent = String.format(launcherTemplate, invocation);

// argv0 is printed by libFuzzer during reproduction, so have the launcher basename contain
// "jazzer".
Path launcher;
if (isAndroid()) {
launcher = Files.createTempFile(
Expand Down

0 comments on commit bf66576

Please sign in to comment.