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

login
register
mail settings
Submitter phabricator
Date Jan. 23, 2019, 5:46 a.m.
Message ID <2dc646254ff82258f0574280374e4a8e@localhost.localdomain>
Download mbox | patch
Permalink /patch/37914/
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 rHGafc33a5705b9: fuzz: don&#039;t allow enormous revlog inputs either (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5640?vs=13336&id=13353

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

AFFECTED FILES
  contrib/fuzz/revlog.cc

CHANGE DETAILS




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

Patch

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