summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
+}