Lagom/Fuzzers: Add CSS parser fuzzer

This commit is contained in:
Luke Wilde 2022-05-29 23:55:49 +01:00 committed by Linus Groh
parent 80a074b2e4
commit be36557198
Notes: sideshowbarker 2024-07-17 10:34:07 +09:00
2 changed files with 18 additions and 0 deletions

View file

@ -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)

View file

@ -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;
}