summaryrefslogtreecommitdiff
path: root/Meta
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-09-18 10:02:52 -0700
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-09-18 17:15:08 +0000
commitaa118642aaf1612598f6dfe4bbb484803cc96929 (patch)
treec1c3ba78320f670eb572935b89aa232df54f492f /Meta
parent4f5d71b4e8582f031ae66dc392035f4f69491b8f (diff)
downloadserenity-aa118642aaf1612598f6dfe4bbb484803cc96929.zip
Lagom/Fuzzers: Add fuzzer for the LibCrypto PEM parser
Diffstat (limited to 'Meta')
-rw-r--r--Meta/Lagom/Fuzzers/CMakeLists.txt1
-rw-r--r--Meta/Lagom/Fuzzers/FuzzPEM.cpp15
2 files changed, 16 insertions, 0 deletions
diff --git a/Meta/Lagom/Fuzzers/CMakeLists.txt b/Meta/Lagom/Fuzzers/CMakeLists.txt
index d84f741529..ffd286a893 100644
--- a/Meta/Lagom/Fuzzers/CMakeLists.txt
+++ b/Meta/Lagom/Fuzzers/CMakeLists.txt
@@ -28,6 +28,7 @@ add_simple_fuzzer(FuzzGzipDecompression LagomCompress)
add_simple_fuzzer(FuzzICOLoader LagomGfx)
add_simple_fuzzer(FuzzJPGLoader LagomGfx)
add_simple_fuzzer(FuzzMD5 LagomCrypto)
+add_simple_fuzzer(FuzzPEM LagomCrypto)
add_simple_fuzzer(FuzzPNGLoader LagomGfx)
add_simple_fuzzer(FuzzPBMLoader LagomGfx)
add_simple_fuzzer(FuzzPGMLoader LagomGfx)
diff --git a/Meta/Lagom/Fuzzers/FuzzPEM.cpp b/Meta/Lagom/Fuzzers/FuzzPEM.cpp
new file mode 100644
index 0000000000..cf950ebda0
--- /dev/null
+++ b/Meta/Lagom/Fuzzers/FuzzPEM.cpp
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2021, Brian Gianforcaro <bgianf@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <LibCrypto/ASN1/PEM.h>
+#include <stddef.h>
+#include <stdint.h>
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
+{
+ (void)Crypto::decode_pem({ data, size });
+ return 0;
+}