summaryrefslogtreecommitdiff
path: root/Meta/Lagom/Fuzzers
diff options
context:
space:
mode:
authorAndrew Kaster <akaster@serenityos.org>2022-02-20 01:42:54 -0700
committerLinus Groh <mail@linusgroh.de>2022-02-20 19:04:59 +0000
commitfb179bc2893b9f98844dc672390a53b219a79f26 (patch)
tree82fde870a61af4b58086a2f967ceedead781060c /Meta/Lagom/Fuzzers
parent0c95d9962cbae11e9c26ba0984dc6080bf1b93a5 (diff)
downloadserenity-fb179bc2893b9f98844dc672390a53b219a79f26.zip
Fuzzers: Avoid unnecessary ByteBuffer copies in FuzzWAVLoader
Avoid trying to memcpy from 0-byte sources as well, by bailing early on nullptr data inputs.
Diffstat (limited to 'Meta/Lagom/Fuzzers')
-rw-r--r--Meta/Lagom/Fuzzers/FuzzWAVLoader.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Meta/Lagom/Fuzzers/FuzzWAVLoader.cpp b/Meta/Lagom/Fuzzers/FuzzWAVLoader.cpp
index 6e0c21f21f..92a183f4b2 100644
--- a/Meta/Lagom/Fuzzers/FuzzWAVLoader.cpp
+++ b/Meta/Lagom/Fuzzers/FuzzWAVLoader.cpp
@@ -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();