Patchwork D5642: fuzz: restrict manifest input size

login
register
mail settings
Submitter phabricator
Date Jan. 23, 2019, 5:46 a.m.
Message ID <490b3c5ed5102838e73cafd9086a5003@localhost.localdomain>
Download mbox | patch
Permalink /patch/37916/
State Not Applicable
Headers show

Comments

phabricator - Jan. 23, 2019, 5:46 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG44cd432aed9f: fuzz: restrict manifest input size (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5642?vs=13338&id=13355

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

AFFECTED FILES
  contrib/fuzz/manifest.cc

CHANGE DETAILS




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

Patch

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();