changeset 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 8ddc5d8bea25
children 92a5fb73b3d5
files contrib/fuzz/xdiff.cc
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/fuzz/xdiff.cc	Tue Jan 08 17:52:39 2019 -0800
+++ b/contrib/fuzz/xdiff.cc	Tue Jan 08 10:31:10 2019 -0500
@@ -22,6 +22,11 @@
 
 int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
 {
+	// Don't allow fuzzer inputs larger than 100k, since we'll just bog
+	// down and not accomplish much.
+	if (Size > 100000) {
+		return 0;
+	}
 	auto maybe_inputs = SplitInputs(Data, Size);
 	if (!maybe_inputs) {
 		return 0;