changeset 41309:afc33a5705b9

fuzz: don't allow enormous revlog inputs either I'm about to make the fuzzer do more, and without this it was getting enthusiastic about large (and therefore slow) inputs that I don't think buy us much. Differential Revision: https://phab.mercurial-scm.org/D5640
author Augie Fackler <raf@durin42.com>
date Tue, 22 Jan 2019 11:18:05 -0500
parents a322dbee4eda
children ebe51a2e75be
files contrib/fuzz/revlog.cc
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/fuzz/revlog.cc	Tue Jan 22 10:55:45 2019 -0800
+++ b/contrib/fuzz/revlog.cc	Tue Jan 22 11:18:05 2019 -0500
@@ -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();