summaryrefslogtreecommitdiff
path: root/Meta/Lagom/Fuzzers
diff options
context:
space:
mode:
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;
+}