diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-05-04 04:25:48 +0430 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-05-21 00:15:23 +0100 |
commit | ba2fce14d31e134901898bbf235771c5b6a7fb01 (patch) | |
tree | 55cc3f9220a274c34f949334e874a348750eb485 /Meta/Lagom/Fuzzers | |
parent | 90e5f607bd326ab6089ce435f79983f3272862d5 (diff) | |
download | serenity-ba2fce14d31e134901898bbf235771c5b6a7fb01.zip |
Meta: Add a Wasm parser fuzzer
Diffstat (limited to 'Meta/Lagom/Fuzzers')
-rw-r--r-- | Meta/Lagom/Fuzzers/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Meta/Lagom/Fuzzers/FuzzWasmParser.cpp | 20 |
2 files changed, 21 insertions, 0 deletions
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 <AK/MemoryStream.h> +#include <AK/Stream.h> +#include <LibWasm/Types.h> +#include <stddef.h> +#include <stdint.h> + +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; +} |