aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorFabian Meumertzheim <meumertzheim@code-intelligence.com>2021-03-24 10:14:13 +0100
committerFabian Meumertzheim <fabian@meumertzhe.im>2021-03-24 17:49:58 +0100
commit6e2e580d6d98623c90d6815b4e3f910879e039b6 (patch)
treef79d7a3538508fb833f92061dea163fde231ded1 /examples
parentf01b430d104479fc7dafe80ba9f5f41daa632623 (diff)
downloadjazzer-api-6e2e580d6d98623c90d6815b4e3f910879e039b6.tar.gz
Annotate severity and deduplicate StackOverflowErrors in Kotlin
Instead of parsing and modifying the stack trace in the driver, a preprocessing step in Kotlin now adds the severity markers. It also performs basic deduplication of StackOverflowErrors.
Diffstat (limited to 'examples')
-rw-r--r--examples/BUILD.bazel8
-rw-r--r--examples/src/main/java/com/example/ExampleStackOverflowFuzzer.java33
2 files changed, 41 insertions, 0 deletions
diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel
index 8c9a2f7a..bebda6f9 100644
--- a/examples/BUILD.bazel
+++ b/examples/BUILD.bazel
@@ -48,6 +48,14 @@ java_fuzz_target_test(
)
java_fuzz_target_test(
+ name = "ExampleStackOverflowFuzzer",
+ srcs = [
+ "src/main/java/com/example/ExampleStackOverflowFuzzer.java",
+ ],
+ target_class = "com.example.ExampleStackOverflowFuzzer",
+)
+
+java_fuzz_target_test(
name = "JpegImageParserFuzzer",
srcs = [
"src/main/java/com/example/JpegImageParserFuzzer.java",
diff --git a/examples/src/main/java/com/example/ExampleStackOverflowFuzzer.java b/examples/src/main/java/com/example/ExampleStackOverflowFuzzer.java
new file mode 100644
index 00000000..47166af4
--- /dev/null
+++ b/examples/src/main/java/com/example/ExampleStackOverflowFuzzer.java
@@ -0,0 +1,33 @@
+// Copyright 2021 Code Intelligence GmbH
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.example;
+
+import java.math.BigDecimal;
+
+public class ExampleStackOverflowFuzzer {
+ public static void fuzzerTestOneInput(byte[] input) {
+ step1();
+ }
+
+ private static void step1() {
+ BigDecimal unused = BigDecimal.valueOf(10, 100);
+ step2();
+ }
+
+ private static void step2() {
+ boolean unused = "foobar".contains("bar");
+ step1();
+ }
+}