summaryrefslogtreecommitdiff
path: root/Meta/Lagom/Fuzzers
diff options
context:
space:
mode:
authorLuke <luke.wilde@live.co.uk>2021-05-31 11:43:22 +0100
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-05-31 17:07:52 +0430
commit3bc2527ce7780e7d9bbe1290e7edf044622b8314 (patch)
treec0e8a55a17d1fdef3aef8cb39c832ec034264a62 /Meta/Lagom/Fuzzers
parent6219c3ec3cc292df1d790c5175456e81ce7b1242 (diff)
downloadserenity-3bc2527ce7780e7d9bbe1290e7edf044622b8314.zip
Lagom/Fuzzers: Add SQL parser fuzzer
Diffstat (limited to 'Meta/Lagom/Fuzzers')
-rw-r--r--Meta/Lagom/Fuzzers/CMakeLists.txt1
-rw-r--r--Meta/Lagom/Fuzzers/FuzzSQLParser.cpp16
2 files changed, 17 insertions, 0 deletions
diff --git a/Meta/Lagom/Fuzzers/CMakeLists.txt b/Meta/Lagom/Fuzzers/CMakeLists.txt
index 9bb0ab0d73..4dea064ead 100644
--- a/Meta/Lagom/Fuzzers/CMakeLists.txt
+++ b/Meta/Lagom/Fuzzers/CMakeLists.txt
@@ -39,6 +39,7 @@ add_simple_fuzzer(FuzzMarkdown)
add_simple_fuzzer(FuzzRegexECMA262)
add_simple_fuzzer(FuzzRegexPosixExtended)
add_simple_fuzzer(FuzzShell)
+add_simple_fuzzer(FuzzSQLParser)
add_simple_fuzzer(FuzzTTF)
add_simple_fuzzer(FuzzURL)
add_simple_fuzzer(FuzzUTF16BEDecoder)
diff --git a/Meta/Lagom/Fuzzers/FuzzSQLParser.cpp b/Meta/Lagom/Fuzzers/FuzzSQLParser.cpp
new file mode 100644
index 0000000000..0532e83274
--- /dev/null
+++ b/Meta/Lagom/Fuzzers/FuzzSQLParser.cpp
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <LibSQL/Lexer.h>
+#include <LibSQL/Parser.h>
+#include <stdio.h>
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
+{
+ auto parser = SQL::Parser(SQL::Lexer({ data, size }));
+ [[maybe_unused]] auto statement = parser.next_statement();
+ return 0;
+}