aboutsummaryrefslogtreecommitdiff
path: root/examples/src/main/java/com/example/ExampleValueProfileFuzzer.java
diff options
context:
space:
mode:
authorFabian Meumertzheim <meumertzheim@code-intelligence.com>2021-02-23 18:00:48 +0100
committerFabian Meumertzheim <fabian@meumertzhe.im>2021-02-24 16:28:10 +0100
commit541c5c63f1f1e3025da8073fc106a7ffe5ce73b2 (patch)
tree0233e15358e2c240376d51d2faeb17a889cf0539 /examples/src/main/java/com/example/ExampleValueProfileFuzzer.java
parent4fb408bdcbfb32b207c0b92cc98bc3e95c9f7665 (diff)
downloadjazzer-api-541c5c63f1f1e3025da8073fc106a7ffe5ce73b2.tar.gz
Make fuzzerTestOneInput void
Java assertion errors are impossible to deduplicate and easily replaced by an assert or a check and a custom exception. This commit makes both variants of fuzzerTestOneInput void methods and adds a note about this change to the respective error message.
Diffstat (limited to 'examples/src/main/java/com/example/ExampleValueProfileFuzzer.java')
-rw-r--r--examples/src/main/java/com/example/ExampleValueProfileFuzzer.java5
1 files changed, 2 insertions, 3 deletions
diff --git a/examples/src/main/java/com/example/ExampleValueProfileFuzzer.java b/examples/src/main/java/com/example/ExampleValueProfileFuzzer.java
index 1eb55df0..1200c560 100644
--- a/examples/src/main/java/com/example/ExampleValueProfileFuzzer.java
+++ b/examples/src/main/java/com/example/ExampleValueProfileFuzzer.java
@@ -27,14 +27,14 @@ public class ExampleValueProfileFuzzer {
return input ^ key;
}
- public static boolean fuzzerTestOneInput(FuzzedDataProvider data) {
+ public static void fuzzerTestOneInput(FuzzedDataProvider data) {
// Without -use_value_profile=1, the fuzzer gets stuck here as there is no direct correspondence
// between the input bytes and the compared string. With value profile, the fuzzer can guess the
// expected input byte by byte, which takes linear rather than exponential time.
if (base64(data.consumeBytes(6)).equals("SmF6emVy")) {
long[] plaintextBlocks = data.consumeLongs(2);
if (plaintextBlocks.length != 2)
- return false;
+ return;
if (insecureEncrypt(plaintextBlocks[0]) == 0x9fc48ee64d3dc090L) {
// Without --fake_pcs (enabled by default with -use_value_profile=1), the fuzzer would get
// stuck here as the value profile information for long comparisons would not be able to
@@ -44,7 +44,6 @@ public class ExampleValueProfileFuzzer {
}
}
}
- return false;
}
private static void mustNeverBeCalled() {