Fuzzers: Avoid unnecessary ByteBuffer copies in FuzzWAVLoader

Avoid trying to memcpy from 0-byte sources as well, by bailing early on
nullptr data inputs.
This commit is contained in:
Andrew Kaster 2022-02-20 01:42:54 -07:00 committed by Linus Groh
parent 0c95d9962c
commit fb179bc289
Notes: sideshowbarker 2024-07-17 18:28:48 +09:00

View file

@ -10,8 +10,10 @@
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());
if (!data)
return 0;
auto wav_data = ReadonlyBytes { data, size };
auto wav = make<Audio::WavLoaderPlugin>(wav_data);
for (;;) {
auto samples = wav->get_more_samples();