summaryrefslogtreecommitdiff
path: root/Meta/Lagom/Fuzzers
diff options
context:
space:
mode:
authorLuke Wilde <lukew@serenityos.org>2022-05-29 23:55:49 +0100
committerLinus Groh <mail@linusgroh.de>2022-05-30 00:17:11 +0100
commitbe365571980d3d9622735a7432e1958b30e9cf33 (patch)
tree449aedae7330078d9c5e400812c9670194f2e8a1 /Meta/Lagom/Fuzzers
parent80a074b2e45cb259e27331ad99bf0d187328bbe4 (diff)
downloadserenity-be365571980d3d9622735a7432e1958b30e9cf33.zip
Lagom/Fuzzers: Add CSS parser fuzzer
Diffstat (limited to 'Meta/Lagom/Fuzzers')
-rw-r--r--Meta/Lagom/Fuzzers/CMakeLists.txt1
-rw-r--r--Meta/Lagom/Fuzzers/FuzzCSSParser.cpp17
2 files changed, 18 insertions, 0 deletions
diff --git a/Meta/Lagom/Fuzzers/CMakeLists.txt b/Meta/Lagom/Fuzzers/CMakeLists.txt
index af33a69a10..48f400d6f7 100644
--- a/Meta/Lagom/Fuzzers/CMakeLists.txt
+++ b/Meta/Lagom/Fuzzers/CMakeLists.txt
@@ -20,6 +20,7 @@ endfunction()
add_simple_fuzzer(FuzzBMPLoader LagomGfx)
add_simple_fuzzer(FuzzBrotli LagomCompress)
+add_simple_fuzzer(FuzzCSSParser LagomWeb)
add_simple_fuzzer(FuzzCyrillicDecoder LagomTextCodec)
add_simple_fuzzer(FuzzDeflateCompression LagomCompress)
add_simple_fuzzer(FuzzDeflateDecompression LagomCompress)
diff --git a/Meta/Lagom/Fuzzers/FuzzCSSParser.cpp b/Meta/Lagom/Fuzzers/FuzzCSSParser.cpp
new file mode 100644
index 0000000000..2e6d680571
--- /dev/null
+++ b/Meta/Lagom/Fuzzers/FuzzCSSParser.cpp
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <LibCore/EventLoop.h>
+#include <LibWeb/CSS/Parser/Parser.h>
+#include <LibWeb/DOM/Document.h>
+
+extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
+{
+ Core::EventLoop loop;
+ auto document = Web::DOM::Document::create();
+ (void)Web::parse_css_stylesheet(Web::CSS::Parser::ParsingContext(document), { data, size });
+ return 0;
+}