Skip to content

Commit

Permalink
Ignore JetBrains classes during instrumentation
Browse files Browse the repository at this point in the history
Some JetBrains products interact badly with Jazzer's agent /
instrumentation, e.g. their coverage agent. It's reasonable to ignore
all JetBrains classes.
  • Loading branch information
bertschneider committed Jun 12, 2023
1 parent fc0cb5d commit 8df988a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ class RuntimeInstrumentor(
.acceptClasses(className)
.scan()
.use {
it.getClassInfo(className).resource.load()
it.getClassInfo(className)?.resource?.load() ?: run {
Log.warn("Failed to load bytecode of class $className")
return null
}
}
val (instrumentedBytecode, duration) = measureTimedValue {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private static void applyCommonConfiguration() {
// Do not hook common IDE and JUnit classes and their dependencies.
System.setProperty("jazzer.custom_hook_excludes",
String.join(File.pathSeparator, "com.google.testing.junit.**", "com.intellij.**",
"io.github.classgraph.**", "junit.framework.**", "net.bytebuddy.**",
"org.jetbrains.**", "io.github.classgraph.**", "junit.framework.**", "net.bytebuddy.**",
"org.apiguardian.**", "org.assertj.core.**", "org.hamcrest.**", "org.junit.**",
"org.opentest4j.**", "org.mockito.**", "org.apache.maven.**", "org.gradle.**"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ private val BASE_EXCLUDED_CLASS_NAME_GLOBS = listOf(
"org.junit.**", // dependency of @FuzzTest
"org.mockito.**", // can cause instrumentation cycles
"net.bytebuddy.**", // ignore Byte Buddy, though it's probably shaded
"org.jetbrains.**", // ignore JetBrains products (coverage agent)
) + if (IS_BAZEL_COVERAGE_RUN) ADDITIONAL_EXCLUDED_NAME_GLOBS_FOR_BAZEL_COVERAGE else listOf()

class ClassNameGlobber(includes: List<String>, excludes: List<String>) {
Expand Down

0 comments on commit 8df988a

Please sign in to comment.