From b280366c6e4f81d9483aed7c38c957257ac3396b Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 13 Mar 2023 10:37:54 -0700 Subject: Fuzzer: Limit array sizes (#5569) Even with a 1% chance of a huge array, there is a second problem aside from hitting an allocation failure, which is DoS - building such a huge array of Literals takes noticeable time in the fuzzer. Instead, just limit array max sizes, which is consistent with what we do for struct sizes etc. --- src/tools/fuzzing/parameters.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/tools/fuzzing/parameters.h') diff --git a/src/tools/fuzzing/parameters.h b/src/tools/fuzzing/parameters.h index 9e5cefd9a..dd5c8d82c 100644 --- a/src/tools/fuzzing/parameters.h +++ b/src/tools/fuzzing/parameters.h @@ -38,6 +38,9 @@ constexpr int MAX_TUPLE_SIZE = 6; // The maximum number of struct fields. static const int MAX_STRUCT_SIZE = 6; +// The maximum number of elements in an array. +static const int MAX_ARRAY_SIZE = 100; + // The number of nontrivial heap types to generate. constexpr int MIN_HEAPTYPES = 4; constexpr int MAX_HEAPTYPES = 20; -- cgit v1.2.3