diff options
author | Fabian Meumertzheim <fabian@meumertzhe.im> | 2022-04-05 10:46:26 +0200 |
---|---|---|
committer | Fabian Meumertzheim <fabian@meumertzhe.im> | 2022-04-05 17:43:08 +0200 |
commit | 9107b16b9ec05ba9c4f4ec047bd335639099126d (patch) | |
tree | 29d510fdcf015ec9a1066a01aa9ac137399b045f /driver/jvm_tooling.cpp | |
parent | d275e4ac1a7eeceb6de7c9e48d65f0b76e2574e7 (diff) | |
download | jazzer-api-9107b16b9ec05ba9c4f4ec047bd335639099126d.tar.gz |
Add the agent to the classpath with --nohooks
Fixes https://github.com/google/oss-fuzz/issues/7507
Diffstat (limited to 'driver/jvm_tooling.cpp')
-rw-r--r-- | driver/jvm_tooling.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/driver/jvm_tooling.cpp b/driver/jvm_tooling.cpp index 688d7c4a..35bd8bad 100644 --- a/driver/jvm_tooling.cpp +++ b/driver/jvm_tooling.cpp @@ -238,7 +238,14 @@ JVM::JVM(std::string_view executable_path, std::string_view seed) { std::string class_path = absl::StrFormat("-Djava.class.path=%s", FLAGS_cp); const auto class_path_from_env = std::getenv("JAVA_FUZZER_CLASSPATH"); if (class_path_from_env) { - class_path += absl::StrFormat(ARG_SEPARATOR "%s", class_path_from_env); + class_path += absl::StrCat(ARG_SEPARATOR, class_path_from_env); + } + if (!FLAGS_hooks) { + // A Java agent is implicitly added to the system class loader's classpath, + // so there is no need to add the Jazzer agent here if we are running with + // the agent enabled. + class_path += + absl::StrCat(ARG_SEPARATOR, getInstrumentorAgentPath(executable_path)); } LOG(INFO) << "got class path " << class_path; |