diff --git a/Meta/Lagom/Fuzzers/CMakeLists.txt b/Meta/Lagom/Fuzzers/CMakeLists.txt index d0e4a5f82d..9bb0ab0d73 100644 --- a/Meta/Lagom/Fuzzers/CMakeLists.txt +++ b/Meta/Lagom/Fuzzers/CMakeLists.txt @@ -44,6 +44,7 @@ add_simple_fuzzer(FuzzURL) add_simple_fuzzer(FuzzUTF16BEDecoder) add_simple_fuzzer(FuzzRSAKeyParsing) add_simple_fuzzer(FuzzWAVLoader) +add_simple_fuzzer(FuzzWasmParser) add_simple_fuzzer(FuzzZip) add_simple_fuzzer(FuzzZlibDecompression) diff --git a/Meta/Lagom/Fuzzers/FuzzWasmParser.cpp b/Meta/Lagom/Fuzzers/FuzzWasmParser.cpp new file mode 100644 index 0000000000..7bdfe4b6bd --- /dev/null +++ b/Meta/Lagom/Fuzzers/FuzzWasmParser.cpp @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2021, the SerenityOS developers. + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include +#include +#include +#include + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + ReadonlyBytes bytes { data, size }; + InputMemoryStream stream { bytes }; + [[maybe_unused]] auto result = Wasm::Module::parse(stream); + stream.handle_any_error(); + return 0; +}