summaryrefslogtreecommitdiff
path: root/Meta/Lagom/Fuzzers/FuzzFlacLoader.cpp
blob: eafc31d3feed458fe88f238c5cd24545e07df344 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
 * Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <LibAudio/FlacLoader.h>
#include <stddef.h>
#include <stdint.h>

extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
    auto flac_data = ByteBuffer::copy(data, size).release_value();
    auto flac = make<Audio::FlacLoaderPlugin>(flac_data);

    if (!flac->sniff())
        return 1;

    while (flac->get_more_samples())
        ;

    return 0;
}