Mercurial > hg
comparison contrib/fuzz/xdiff.cc @ 41139:2e60a77b7058
xdiff: don't attempt to use fuzzer inputs larger than 100k
This is the recommended approach from [0], and limiting the input was
suggested in https://github.com/google/oss-fuzz/issues/2076 when
discussing our broken coverage build.
0: https://github.com/google/oss-fuzz/blob/master/docs/new_project_guide.md#custom-libfuzzer-options-for-clusterfuzz
Differential Revision: https://phab.mercurial-scm.org/D5525
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 08 Jan 2019 10:31:10 -0500 |
parents | fa0ddd5e8fff |
children | 78df32a8b6f4 |
comparison
equal
deleted
inserted
replaced
41138:8ddc5d8bea25 | 41139:2e60a77b7058 |
---|---|
20 return 0; | 20 return 0; |
21 } | 21 } |
22 | 22 |
23 int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) | 23 int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) |
24 { | 24 { |
25 // Don't allow fuzzer inputs larger than 100k, since we'll just bog | |
26 // down and not accomplish much. | |
27 if (Size > 100000) { | |
28 return 0; | |
29 } | |
25 auto maybe_inputs = SplitInputs(Data, Size); | 30 auto maybe_inputs = SplitInputs(Data, Size); |
26 if (!maybe_inputs) { | 31 if (!maybe_inputs) { |
27 return 0; | 32 return 0; |
28 } | 33 } |
29 auto inputs = std::move(maybe_inputs.value()); | 34 auto inputs = std::move(maybe_inputs.value()); |