summaryrefslogtreecommitdiff
path: root/Meta/Lagom/Fuzzers/FuzzWasmParser.cpp
blob: d5c5acbe175114d2763c1e74d8e75196b504d975 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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(uint8_t const* 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;
}