fuzz: restrict manifest input size
authorAugie Fackler <raf@durin42.com>
Tue, 22 Jan 2019 11:41:09 -0500
changeset 41311 44cd432aed9f
parent 41310 ebe51a2e75be
child 41312 d60bd5c71cbb
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
contrib/fuzz/manifest.cc
--- 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();