summaryrefslogtreecommitdiff
path: root/Meta/Lagom/Fuzzers
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-11-29 16:19:13 +0330
committerAndreas Kling <kling@serenityos.org>2020-11-29 16:22:44 +0100
commit1ecea2f10511ffac8478d00935500be416b5228b (patch)
tree2de4c23ac240acefca0fc10ca14a0f829f17fce9 /Meta/Lagom/Fuzzers
parente4bd5a5d69e23c79fee71506eed4b866ea6e0dc3 (diff)
downloadserenity-1ecea2f10511ffac8478d00935500be416b5228b.zip
Lagom: Add a Shell parser fuzzer
Diffstat (limited to 'Meta/Lagom/Fuzzers')
-rw-r--r--Meta/Lagom/Fuzzers/CMakeLists.txt1
-rw-r--r--Meta/Lagom/Fuzzers/FuzzShell.cpp38
2 files changed, 39 insertions, 0 deletions
diff --git a/Meta/Lagom/Fuzzers/CMakeLists.txt b/Meta/Lagom/Fuzzers/CMakeLists.txt
index 33be3357b1..c872ecb44a 100644
--- a/Meta/Lagom/Fuzzers/CMakeLists.txt
+++ b/Meta/Lagom/Fuzzers/CMakeLists.txt
@@ -29,6 +29,7 @@ add_simple_fuzzer(FuzzJs)
add_simple_fuzzer(FuzzMarkdown)
add_simple_fuzzer(FuzzRegexECMA262)
add_simple_fuzzer(FuzzRegexPosixExtended)
+add_simple_fuzzer(FuzzShell)
if (NOT ENABLE_OSS_FUZZ)
add_executable(FuzzilliJs FuzzilliJs.cpp)
diff --git a/Meta/Lagom/Fuzzers/FuzzShell.cpp b/Meta/Lagom/Fuzzers/FuzzShell.cpp
new file mode 100644
index 0000000000..abb02c2f68
--- /dev/null
+++ b/Meta/Lagom/Fuzzers/FuzzShell.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2020, the SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <AK/StringView.h>
+#include <Shell/Shell.h>
+#include <stddef.h>
+#include <stdint.h>
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
+{
+ auto source = AK::StringView(static_cast<const unsigned char*>(data), size);
+ Shell::Parser parser(source);
+ parser.parse();
+ return 0;
+}