D5525: xdiff: don't attempt to use fuzzer inputs larger than 100k

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Tue Jan 8 15:31:32 UTC 2019


durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5525

AFFECTED FILES
  contrib/fuzz/xdiff.cc

CHANGE DETAILS

diff --git a/contrib/fuzz/xdiff.cc b/contrib/fuzz/xdiff.cc
--- a/contrib/fuzz/xdiff.cc
+++ b/contrib/fuzz/xdiff.cc
@@ -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;



To: durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list