aboutsummaryrefslogtreecommitdiff
path: root/agent/src/main/java/com/code_intelligence/jazzer/runtime/TraceDataFlowNativeCallbacks.java
diff options
context:
space:
mode:
Diffstat (limited to 'agent/src/main/java/com/code_intelligence/jazzer/runtime/TraceDataFlowNativeCallbacks.java')
-rw-r--r--agent/src/main/java/com/code_intelligence/jazzer/runtime/TraceDataFlowNativeCallbacks.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/agent/src/main/java/com/code_intelligence/jazzer/runtime/TraceDataFlowNativeCallbacks.java b/agent/src/main/java/com/code_intelligence/jazzer/runtime/TraceDataFlowNativeCallbacks.java
index efbc3411..d759e282 100644
--- a/agent/src/main/java/com/code_intelligence/jazzer/runtime/TraceDataFlowNativeCallbacks.java
+++ b/agent/src/main/java/com/code_intelligence/jazzer/runtime/TraceDataFlowNativeCallbacks.java
@@ -15,11 +15,28 @@
package com.code_intelligence.jazzer.runtime;
import com.code_intelligence.jazzer.utils.Utils;
+import com.github.fmeum.rules_jni.RulesJni;
import java.lang.reflect.Executable;
import java.nio.charset.Charset;
@SuppressWarnings("unused")
final public class TraceDataFlowNativeCallbacks {
+ static {
+ try {
+ RulesJni.loadLibrary("jazzer_fuzzer_callbacks", TraceDataFlowNativeCallbacks.class);
+ } catch (UnsatisfiedLinkError e) {
+ // On Windows, we link the fuzzer callbacks statically instead and thus expect this library
+ // load to fail.
+ if (!System.getProperty("os.name").startsWith("Windows")) {
+ // In some scenarios (e.g. Java unit tests that do not go through the driver), this native
+ // library load will expectedly fail due to missing symbols. We make this case non-fatal as
+ // every actual usage of native methods in this class would result in another
+ // UnsatisfiedLinkError.
+ e.printStackTrace();
+ }
+ }
+ }
+
// Making this static final ensures that the JIT will eliminate the dead branch of a construct
// such as:
// if (USE_FAKE_PCS) ... else ...