Lagom/Fuzzers: Add fuzzer for FLAC loader

This commit is contained in:
Luke 2021-07-12 21:55:21 +01:00 committed by Gunnar Beutner
parent bc44753adb
commit 448e8c6f45
Notes: sideshowbarker 2024-07-18 09:09:15 +09:00
2 changed files with 24 additions and 0 deletions

View file

@ -20,6 +20,7 @@ add_simple_fuzzer(FuzzCyrillicDecoder)
add_simple_fuzzer(FuzzDeflateCompression)
add_simple_fuzzer(FuzzDeflateDecompression)
add_simple_fuzzer(FuzzELF)
add_simple_fuzzer(FuzzFlacLoader)
add_simple_fuzzer(FuzzGemini)
add_simple_fuzzer(FuzzGIFLoader)
add_simple_fuzzer(FuzzGzipCompression)

View file

@ -0,0 +1,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);
auto flac = make<Audio::FlacLoaderPlugin>(flac_data);
if (!flac->sniff())
return 1;
while (flac->get_more_samples())
;
return 0;
}