Skip to content

Commit 7e8d53b

Browse files
authored
Improve documentation to discourage non-zero returncodes (#12955)
This PR adds a small documentation change to discourage the use of non-zero return values. Based on this issue #11983, Honggfuzz does not support other return values, while libFuzzer, in my opinion unexpectedly, discards inputs for return values other than zero which can cause creation of faulty harnesses. As a result I think it is fair to discourage all uses of non-zero return values from LLVMFuzzerTestOneInput.
1 parent 1188a70 commit 7e8d53b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

docs/advanced-topics/ideal_integration.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ This makes it easy to maintain the fuzzers and minimizes breakages that can
4545
arise as source code changes over time.
4646

4747
Make sure to fuzz the target locally for a small period of time to ensure that
48-
it does not crash, hang, or run out of memory instantly. If you're having
49-
trouble, read about [what makes a good fuzz
48+
it does not crash, hang, or run out of memory instantly. Also make sure that the fuzzer can
49+
make at least some progress. If you're having trouble, read about [what makes a good fuzz
5050
target](https://github.com/google/fuzzing/blob/master/docs/good-fuzz-target.md).
5151

5252
The interface between the [fuzz target](https://llvm.org/docs/LibFuzzer.html#fuzz-target)
5353
and the fuzzing engines is C, so you can use either C or C++ to implement the
54-
fuzz target.
54+
fuzz target. Make sure to not return values other than **zero** [^1].
5555

5656
Examples:
5757
[boringssl](https://github.com/google/boringssl/tree/master/fuzz),
@@ -64,6 +64,10 @@ Examples:
6464
[pcre2](https://vcs.pcre.org/pcre2/code/trunk/src/pcre2_fuzzsupport.c?view=markup),
6565
[ffmpeg](https://github.com/FFmpeg/FFmpeg/blob/master/tools/target_dec_fuzzer.c).
6666

67+
[^1]: While LibFuzzer uses a non-zero value as a signal to discard inputs other fuzzers in
68+
use by OSS-Fuzz do not necessarily support this behavior. (Discarding inputs can be used
69+
to stop a fuzzer from exploring further, which should only be used with good reason.)
70+
6771
## Build support
6872

6973
Many different build systems exist in the open-source world. The less OSS-Fuzz

0 commit comments

Comments
 (0)