xdiff: don't attempt to use fuzzer inputs larger than 100k
authorAugie Fackler <augie@google.com>
Tue, 08 Jan 2019 10:31:10 -0500
changeset 41139 2e60a77b7058
parent 41138 8ddc5d8bea25
child 41140 92a5fb73b3d5
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
contrib/fuzz/xdiff.cc
--- 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;