summaryrefslogtreecommitdiff
path: root/Meta
diff options
context:
space:
mode:
authorAndrew Kaster <akaster@serenityos.org>2022-10-11 21:44:06 -0600
committerLinus Groh <mail@linusgroh.de>2022-10-13 11:25:03 +0200
commitb704f824875a806bcda10e2dc1b0859cb4720c59 (patch)
treedca8e84fe51ece1ddd23dd0c97cb756463210e6d /Meta
parentbf014c4d206074e2a4e2499c8b898325c0b8062f (diff)
downloadserenity-b704f824875a806bcda10e2dc1b0859cb4720c59.zip
Fuzzers: Add VP9Decoder and MatroskaReader fuzzers for LibVideo
Diffstat (limited to 'Meta')
-rw-r--r--Meta/Lagom/Fuzzers/CMakeLists.txt2
-rw-r--r--Meta/Lagom/Fuzzers/FuzzMatroskaReader.cpp16
-rw-r--r--Meta/Lagom/Fuzzers/FuzzVP9Decoder.cpp16
3 files changed, 34 insertions, 0 deletions
diff --git a/Meta/Lagom/Fuzzers/CMakeLists.txt b/Meta/Lagom/Fuzzers/CMakeLists.txt
index 445c271ade..a9b5c0b6ed 100644
--- a/Meta/Lagom/Fuzzers/CMakeLists.txt
+++ b/Meta/Lagom/Fuzzers/CMakeLists.txt
@@ -32,6 +32,7 @@ add_simple_fuzzer(FuzzGzipCompression LibCompress)
add_simple_fuzzer(FuzzGzipDecompression LibCompress)
add_simple_fuzzer(FuzzICOLoader LibGfx)
add_simple_fuzzer(FuzzJPGLoader LibGfx)
+add_simple_fuzzer(FuzzMatroskaReader LibVideo)
add_simple_fuzzer(FuzzMD5 LibCrypto)
add_simple_fuzzer(FuzzMP3Loader LibAudio)
add_simple_fuzzer(FuzzPEM LibCrypto)
@@ -64,6 +65,7 @@ add_simple_fuzzer(FuzzTTF LibGfx)
add_simple_fuzzer(FuzzURL)
add_simple_fuzzer(FuzzUTF16BEDecoder LibTextCodec)
add_simple_fuzzer(FuzzRSAKeyParsing LibCrypto)
+add_simple_fuzzer(FuzzVP9Decoder LibVideo)
add_simple_fuzzer(FuzzWAVLoader LibAudio)
add_simple_fuzzer(FuzzWasmParser LibWasm)
add_simple_fuzzer(FuzzWOFF LibGfx)
diff --git a/Meta/Lagom/Fuzzers/FuzzMatroskaReader.cpp b/Meta/Lagom/Fuzzers/FuzzMatroskaReader.cpp
new file mode 100644
index 0000000000..ac59b7c34c
--- /dev/null
+++ b/Meta/Lagom/Fuzzers/FuzzMatroskaReader.cpp
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2022, the SerenityOS developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <LibVideo/MatroskaReader.h>
+#include <stddef.h>
+
+extern "C" int LLVMFuzzerTestOneInput(u8 const* data, size_t size)
+{
+ auto matroska_document = Video::MatroskaReader::parse_matroska_from_data(data, size);
+ if (!matroska_document)
+ return -1;
+ return 0;
+}
diff --git a/Meta/Lagom/Fuzzers/FuzzVP9Decoder.cpp b/Meta/Lagom/Fuzzers/FuzzVP9Decoder.cpp
new file mode 100644
index 0000000000..4827a1f9aa
--- /dev/null
+++ b/Meta/Lagom/Fuzzers/FuzzVP9Decoder.cpp
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2022, the SerenityOS developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <LibVideo/VP9/Decoder.h>
+#include <stddef.h>
+
+extern "C" int LLVMFuzzerTestOneInput(u8 const* data, size_t size)
+{
+ Video::VP9::Decoder vp9_decoder;
+ if (auto decode_error = vp9_decoder.decode({ data, size }); decode_error.is_error())
+ return -1;
+ return 0;
+}