summaryrefslogtreecommitdiff
path: root/Meta/Lagom/Fuzzers
diff options
context:
space:
mode:
authorLuke <luke.wilde@live.co.uk>2021-07-12 21:48:27 +0100
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-07-13 01:34:22 +0430
commit93340685ed54d38a7aca8001b4bcf43580291e91 (patch)
treeb51b47e921cc041e9cf46ae8274508d7bffd8dc4 /Meta/Lagom/Fuzzers
parent2a1bf534357377de5bf5cb2a019fcc701d58bb7a (diff)
downloadserenity-93340685ed54d38a7aca8001b4bcf43580291e91.zip
Lagom/Fuzzers: Add fuzzer for POSIX basic regex parser
Diffstat (limited to 'Meta/Lagom/Fuzzers')
-rw-r--r--Meta/Lagom/Fuzzers/CMakeLists.txt1
-rw-r--r--Meta/Lagom/Fuzzers/FuzzRegexPosixBasic.cpp17
2 files changed, 18 insertions, 0 deletions
diff --git a/Meta/Lagom/Fuzzers/CMakeLists.txt b/Meta/Lagom/Fuzzers/CMakeLists.txt
index 0b766e322c..ad7034b994 100644
--- a/Meta/Lagom/Fuzzers/CMakeLists.txt
+++ b/Meta/Lagom/Fuzzers/CMakeLists.txt
@@ -39,6 +39,7 @@ add_simple_fuzzer(FuzzLatin1Decoder)
add_simple_fuzzer(FuzzLatin2Decoder)
add_simple_fuzzer(FuzzMarkdown)
add_simple_fuzzer(FuzzRegexECMA262)
+add_simple_fuzzer(FuzzRegexPosixBasic)
add_simple_fuzzer(FuzzRegexPosixExtended)
add_simple_fuzzer(FuzzSHA1)
add_simple_fuzzer(FuzzSHA256)
diff --git a/Meta/Lagom/Fuzzers/FuzzRegexPosixBasic.cpp b/Meta/Lagom/Fuzzers/FuzzRegexPosixBasic.cpp
new file mode 100644
index 0000000000..f66da056b6
--- /dev/null
+++ b/Meta/Lagom/Fuzzers/FuzzRegexPosixBasic.cpp
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <AK/StringView.h>
+#include <LibRegex/Regex.h>
+#include <stddef.h>
+#include <stdint.h>
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
+{
+ auto pattern = StringView(static_cast<const unsigned char*>(data), size);
+ [[maybe_unused]] auto re = Regex<PosixBasic>(pattern);
+ return 0;
+}