D5640: fuzz: don't allow enormous revlog inputs either

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Tue Jan 22 17:02:06 UTC 2019


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

REVISION SUMMARY
  I'm about to make the fuzzer do more, and without this it was getting
  enthusiastic about large (and therefore slow) inputs that I don't
  think buy us much.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/fuzz/revlog.cc

CHANGE DETAILS

diff --git a/contrib/fuzz/revlog.cc b/contrib/fuzz/revlog.cc
--- a/contrib/fuzz/revlog.cc
+++ b/contrib/fuzz/revlog.cc
@@ -31,6 +31,11 @@
 
 int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
 {
+	// Don't allow fuzzer inputs larger than 60k, since we'll just bog
+	// down and not accomplish much.
+	if (Size > 60000) {
+		return 0;
+	}
 	PyObject *text =
 	    PyBytes_FromStringAndSize((const char *)Data, (Py_ssize_t)Size);
 	PyObject *locals = PyDict_New();



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


More information about the Mercurial-devel mailing list