changeset 41336:44cd432aed9f

fuzz: restrict manifest input size Again, let's keep the fuzzer from getting excited about huge inputs. Differential Revision: https://phab.mercurial-scm.org/D5642
author Augie Fackler <raf@durin42.com>
date Tue, 22 Jan 2019 11:41:09 -0500
parents ebe51a2e75be
children d60bd5c71cbb
files contrib/fuzz/manifest.cc
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/fuzz/manifest.cc	Tue Jan 22 11:02:10 2019 -0500
+++ b/contrib/fuzz/manifest.cc	Tue Jan 22 11:41:09 2019 -0500
@@ -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();