Meta: Add a Wasm parser fuzzer

This commit is contained in:
Ali Mohammad Pur 2021-05-04 04:25:48 +04:30 committed by Linus Groh
parent 90e5f607bd
commit ba2fce14d3
2 changed files with 21 additions and 0 deletions

View file

@ -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)

View file

@ -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;
}