mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:07:36 +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
|
@ -45,6 +45,7 @@ add_simple_fuzzer(FuzzPGMLoader LibGfx)
|
||||||
add_simple_fuzzer(FuzzPoly1305 LibCrypto)
|
add_simple_fuzzer(FuzzPoly1305 LibCrypto)
|
||||||
add_simple_fuzzer(FuzzPPMLoader LibGfx)
|
add_simple_fuzzer(FuzzPPMLoader LibGfx)
|
||||||
add_simple_fuzzer(FuzzPDF LibPDF)
|
add_simple_fuzzer(FuzzPDF LibPDF)
|
||||||
|
add_simple_fuzzer(FuzzQOALoader LibAudio)
|
||||||
add_simple_fuzzer(FuzzQOILoader LibGfx)
|
add_simple_fuzzer(FuzzQOILoader LibGfx)
|
||||||
add_simple_fuzzer(FuzzTGALoader LibGfx)
|
add_simple_fuzzer(FuzzTGALoader LibGfx)
|
||||||
add_simple_fuzzer(FuzzQuotedPrintableParser LibIMAP)
|
add_simple_fuzzer(FuzzQuotedPrintableParser LibIMAP)
|
||||||
|
|
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