D5642: fuzz: restrict manifest input size

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


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

REVISION SUMMARY
  Again, let's keep the fuzzer from getting excited about huge inputs.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/fuzz/manifest.cc

CHANGE DETAILS

diff --git a/contrib/fuzz/manifest.cc b/contrib/fuzz/manifest.cc
--- a/contrib/fuzz/manifest.cc
+++ b/contrib/fuzz/manifest.cc
@@ -39,6 +39,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;
+	}
 	PyObject *mtext =
 	    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