summaryrefslogtreecommitdiff
path: root/Meta/Lagom/Fuzzers
diff options
context:
space:
mode:
authorx-yl <kylepereira@mail.com>2021-06-01 17:28:08 +0400
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-06-11 23:58:28 +0430
commitac712b07f9cfc5494bd259976addebabedc091d2 (patch)
tree2dea03aef3def712b96afc17fe9a9c8509185764 /Meta/Lagom/Fuzzers
parent8c6061fc4af79984e2c9fbbb2300567a9f5ebbfe (diff)
downloadserenity-ac712b07f9cfc5494bd259976addebabedc091d2.zip
Meta: Fuzz the LibIMAP Parser
Diffstat (limited to 'Meta/Lagom/Fuzzers')
-rw-r--r--Meta/Lagom/Fuzzers/CMakeLists.txt1
-rw-r--r--Meta/Lagom/Fuzzers/FuzzIMAPParser.cpp17
2 files changed, 18 insertions, 0 deletions
diff --git a/Meta/Lagom/Fuzzers/CMakeLists.txt b/Meta/Lagom/Fuzzers/CMakeLists.txt
index 4dea064ead..7564f819bd 100644
--- a/Meta/Lagom/Fuzzers/CMakeLists.txt
+++ b/Meta/Lagom/Fuzzers/CMakeLists.txt
@@ -32,6 +32,7 @@ add_simple_fuzzer(FuzzPGMLoader)
add_simple_fuzzer(FuzzPPMLoader)
add_simple_fuzzer(FuzzHebrewDecoder)
add_simple_fuzzer(FuzzHttpRequest)
+add_simple_fuzzer(FuzzIMAPParser)
add_simple_fuzzer(FuzzJs)
add_simple_fuzzer(FuzzLatin1Decoder)
add_simple_fuzzer(FuzzLatin2Decoder)
diff --git a/Meta/Lagom/Fuzzers/FuzzIMAPParser.cpp b/Meta/Lagom/Fuzzers/FuzzIMAPParser.cpp
new file mode 100644
index 0000000000..045adc9270
--- /dev/null
+++ b/Meta/Lagom/Fuzzers/FuzzIMAPParser.cpp
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2021, Kyle Pereira <hey@xylepereira.me>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <LibIMAP/Parser.h>
+#include <stddef.h>
+#include <stdint.h>
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
+{
+ auto parser = IMAP::Parser();
+ parser.parse(ByteBuffer::copy(data, size), true);
+ parser.parse(ByteBuffer::copy(data, size), false);
+ return 0;
+}