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

login
register
mail settings
Submitter phabricator
Date Jan. 9, 2019, 9:49 a.m.
Message ID <30813d5e58a475c0e81ec131c7865e7f@localhost.localdomain>
Download mbox | patch
Permalink /patch/37571/
State Not Applicable
Headers show

Comments

phabricator - Jan. 9, 2019, 9:49 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2e60a77b7058: xdiff: don&#039;t attempt to use fuzzer inputs larger than 100k (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5525?vs=13075&id=13090

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

AFFECTED FILES
  contrib/fuzz/xdiff.cc

CHANGE DETAILS




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

Patch

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;