mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:47:45 +00:00
Meta/Lagom: Add a fuzzer for QOA
This commit is contained in:
parent
0b421a3764
commit
0f7a5006d1
2 changed files with 31 additions and 0 deletions
30
Meta/Lagom/Fuzzers/FuzzQOALoader.cpp
Normal file
30
Meta/Lagom/Fuzzers/FuzzQOALoader.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) 2023, kleines Filmröllchen <filmroellchen@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibAudio/QOALoader.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
|
||||
{
|
||||
auto qoa_data = ByteBuffer::copy(data, size).release_value();
|
||||
auto qoa_or_error = Audio::QOALoaderPlugin::create(qoa_data.bytes());
|
||||
|
||||
if (qoa_or_error.is_error())
|
||||
return 0;
|
||||
|
||||
auto qoa = qoa_or_error.release_value();
|
||||
|
||||
for (;;) {
|
||||
auto samples = qoa->get_more_samples();
|
||||
if (samples.is_error())
|
||||
return 0;
|
||||
if (samples.value().size() > 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue