mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
8a92573732
For this change to work "easily", Loader can't take const ByteBuffer's anymore, which is fine for now.
25 lines
587 B
C++
25 lines
587 B
C++
/*
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibAudio/WavLoader.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
|
{
|
|
auto wav_data = ByteBuffer::copy(data, size).release_value();
|
|
auto wav = make<Audio::WavLoaderPlugin>(wav_data.bytes());
|
|
|
|
for (;;) {
|
|
auto samples = wav->get_more_samples();
|
|
if (samples.is_error())
|
|
return 2;
|
|
if (samples.value()->sample_count() > 0)
|
|
break;
|
|
}
|
|
|
|
return 0;
|
|
}
|