mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:27:43 +00:00
LibAudio: Switch LoaderPlugin to a more traditional constructor pattern
This now prepares all the needed (fallible) components before actually constructing a LoaderPlugin object, so we are no longer filling them in at an arbitrary later point in time.
This commit is contained in:
parent
3cf93d0dd2
commit
c57be0f474
12 changed files with 132 additions and 86 deletions
|
@ -11,10 +11,12 @@
|
|||
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
|
||||
{
|
||||
auto flac_data = ByteBuffer::copy(data, size).release_value();
|
||||
auto flac = make<Audio::FlacLoaderPlugin>(flac_data.bytes());
|
||||
auto flac_or_error = Audio::FlacLoaderPlugin::try_create(flac_data.bytes());
|
||||
|
||||
if (flac->initialize().is_error())
|
||||
return 1;
|
||||
if (flac_or_error.is_error())
|
||||
return 0;
|
||||
|
||||
auto flac = flac_or_error.release_value();
|
||||
|
||||
for (;;) {
|
||||
auto samples = flac->get_more_samples();
|
||||
|
|
|
@ -11,10 +11,12 @@
|
|||
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
|
||||
{
|
||||
auto flac_data = ByteBuffer::copy(data, size).release_value();
|
||||
auto mp3 = make<Audio::MP3LoaderPlugin>(flac_data.bytes());
|
||||
auto mp3_or_error = Audio::MP3LoaderPlugin::try_create(flac_data.bytes());
|
||||
|
||||
if (mp3->initialize().is_error())
|
||||
return 1;
|
||||
if (mp3_or_error.is_error())
|
||||
return 0;
|
||||
|
||||
auto mp3 = mp3_or_error.release_value();
|
||||
|
||||
for (;;) {
|
||||
auto samples = mp3->get_more_samples();
|
||||
|
|
|
@ -13,7 +13,12 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
|
|||
if (!data)
|
||||
return 0;
|
||||
auto wav_data = ReadonlyBytes { data, size };
|
||||
auto wav = make<Audio::WavLoaderPlugin>(wav_data);
|
||||
auto wav_or_error = Audio::WavLoaderPlugin::try_create(wav_data);
|
||||
|
||||
if (wav_or_error.is_error())
|
||||
return 0;
|
||||
|
||||
auto wav = wav_or_error.release_value();
|
||||
|
||||
for (;;) {
|
||||
auto samples = wav->get_more_samples();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue