Skip to content

Commit 3c74aa8

Browse files
committed
docs: document Autofuzz constructor excludes
1 parent db73ba1 commit 3c74aa8

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

docs/arguments-and-configuration-options.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ Some parameters only have an effect when used with standalone Jazzer binary (mar
4242
- **autofuzz_ignore** [list, separator=`','`, default=""] (*DEPRECATED*)
4343
- Fully qualified names of exception classes to ignore during fuzzing
4444

45+
- **autofuzz_constructor_excludes** [list, separator=`';'`, default=""] (*DEPRECATED*)
46+
- Exact constructor references to exclude during Autofuzz argument construction
47+
4548
- **command_line** [bool, default="false"]
4649
- Whether Jazzer is running a JUnit fuzz test from the command line
4750

docs/autofuzz.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ Under the hood, Jazzer tries various ways of creating objects from the fuzzer in
1818
For example, if a parameter is an interface or an abstract class, it will look for all concrete implementing classes on the classpath.
1919
Jazzer can also create objects from classes that follow the [builder design pattern](https://www.baeldung.com/creational-design-patterns#builder) or have a default constructor and use setters to set the fields.
2020

21+
Some constructors have undesired side effects or can take a very long time for fuzzed inputs.
22+
Exact constructor references can be excluded via `--autofuzz_constructor_excludes` as a semicolon-separated list:
23+
```
24+
--autofuzz_constructor_excludes='com.example.Dangerous::new(int,java.util.Random);com.example.Dangerous::new(byte[])'
25+
```
26+
The constructor descriptor is exact and uses the same parameter type format as `--autofuzz` method descriptors.
27+
Each exclude must name an accessible constructor that exists when Autofuzz initializes.
28+
Nested classes must be specified with their binary names, for example `com.example.Outer$Inner::new()`.
29+
Globs, regular expressions, and broad `Class::new` excludes are not supported.
30+
Explicitly targeted constructors, for example via `--autofuzz=com.example.Dangerous::new(int)`, are not affected by this option.
31+
2132
Creating objects from fuzzer input can lead to many reported exceptions.
2233
Jazzer addresses this issue by ignoring exceptions that the target method declares to throw.
2334
In addition to that, you can provide a list of exceptions to be ignored during fuzzing via the `--autofuzz_ignore` flag in the form of a comma-separated list.

0 commit comments

Comments
 (0)