From 4b3d5be999baac642e7664da39c37c6012c11513 Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Mon, 15 Nov 2021 17:23:17 -0800 Subject: Add a fuzzer specifically for types (#4328) Add a new fuzzer binary that repeatedly generates random types to find bugs in the type system implementation. Each iteration creates some number of root types followed by some number of subtypes thereof. Each built type can contain arbitrary references to other built types, regardless of their order of construction. Right now the fuzzer only finds fatal errors in type building (and in its own implementation), but it is meant to be extended to check other properties in the future, such as that LUB calculations work as expected. The logic for creating types is also intended to be integrated into the main fuzzer in a follow-on PR so that the main fuzzer can fuzz with arbitrarily more interesting GC types. --- src/tools/fuzzing/random.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/tools/fuzzing/random.cpp') diff --git a/src/tools/fuzzing/random.cpp b/src/tools/fuzzing/random.cpp index 38a86924e..3d8297c15 100644 --- a/src/tools/fuzzing/random.cpp +++ b/src/tools/fuzzing/random.cpp @@ -20,7 +20,8 @@ namespace wasm { -Random::Random(std::vector&& bytes) : bytes(std::move(bytes)) { +Random::Random(std::vector&& bytes, FeatureSet features) + : bytes(std::move(bytes)), features(features) { // Ensure there is *some* input to be read. if (bytes.empty()) { bytes.push_back(0); -- cgit v1.2.3