Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autofuzz: Fix logs for bug detector findings #699

Merged
merged 1 commit into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
* Only used internally.
*/
public class AutofuzzInvocationException extends RuntimeException {
public AutofuzzInvocationException() {
super();
}

public AutofuzzInvocationException(Throwable cause) {
super(cause);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ java_library(
visibility = ["//visibility:public"],
deps = [
"//src/main/java/com/code_intelligence/jazzer/api",
"//src/main/java/com/code_intelligence/jazzer/runtime:jazzer_bootstrap_compile_only",
fmeum marked this conversation as resolved.
Show resolved Hide resolved
"//src/main/java/com/code_intelligence/jazzer/utils",
"//src/main/java/com/code_intelligence/jazzer/utils:log",
"//src/main/java/com/code_intelligence/jazzer/utils:simple_glob_matcher",
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/code_intelligence/jazzer/autofuzz/Meta.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.code_intelligence.jazzer.api.Function4;
import com.code_intelligence.jazzer.api.Function5;
import com.code_intelligence.jazzer.api.FuzzedDataProvider;
import com.code_intelligence.jazzer.runtime.HardToCatchError;
import com.code_intelligence.jazzer.utils.Utils;
import io.github.classgraph.ClassGraph;
import io.github.classgraph.ClassInfoList;
Expand Down Expand Up @@ -286,6 +287,9 @@ Object autofuzz(
// We should ensure that the arguments fed into the method are always valid.
throw new AutofuzzError(getDebugSummary(method, thisObject, arguments), e);
} catch (InvocationTargetException e) {
if (e.getCause() instanceof HardToCatchError) {
throw new AutofuzzInvocationException();
}
throw new AutofuzzInvocationException(e.getCause());
}
}
Expand Down Expand Up @@ -344,6 +348,9 @@ <R> R autofuzz(
// constructors of abstract classes or private constructors.
throw new AutofuzzError(getDebugSummary(constructor, null, arguments), e);
} catch (InvocationTargetException e) {
if (e.getCause() instanceof HardToCatchError) {
throw new AutofuzzInvocationException();
}
throw new AutofuzzInvocationException(e.getCause());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ java_library(
name = "jazzer_bootstrap_compile_only",
neverlink = True,
visibility = [
"//src/main/java/com/code_intelligence/jazzer/autofuzz:__pkg__",
"//src/main/java/com/code_intelligence/jazzer/driver:__pkg__",
"//src/main/java/com/code_intelligence/jazzer/instrumentor:__pkg__",
],
Expand Down