mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
Lagom: Add a Shell parser fuzzer
This commit is contained in:
parent
e4bd5a5d69
commit
1ecea2f105
Notes:
sideshowbarker
2024-07-19 01:12:03 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/1ecea2f1051 Pull-request: https://github.com/SerenityOS/serenity/pull/4235
3 changed files with 46 additions and 3 deletions
|
@ -64,10 +64,14 @@ file(GLOB LIBCRYPTO_SUBDIR_SOURCES CONFIGURE_DEPENDS "../../Libraries/LibCrypto/
|
|||
file(GLOB LIBTLS_SOURCES CONFIGURE_DEPENDS "../../Libraries/LibTLS/*.cpp")
|
||||
file(GLOB SHELL_SOURCES CONFIGURE_DEPENDS "../../Shell/*.cpp")
|
||||
file(GLOB SHELL_TESTS CONFIGURE_DEPENDS "../../Shell/Tests/*.sh")
|
||||
set(SHELL_MAIN_CPP "../../Shell/main.cpp")
|
||||
set(LIB_SHELL_SOURCES ${SHELL_SOURCES})
|
||||
list(REMOVE_ITEM LIB_SHELL_SOURCES ${SHELL_MAIN_CPP})
|
||||
set(SHELL_SOURCES ${SHELL_MAIN_CPP})
|
||||
|
||||
set(LAGOM_REGEX_SOURCES ${LIBREGEX_LIBC_SOURCES} ${LIBREGEX_SOURCES})
|
||||
set(LAGOM_CORE_SOURCES ${AK_SOURCES} ${LIBCORE_SOURCES})
|
||||
set(LAGOM_MORE_SOURCES ${LIBELF_SOURCES} ${LIBIPC_SOURCES} ${LIBLINE_SOURCES} ${LIBJS_SOURCES} ${LIBJS_SUBDIR_SOURCES} ${LIBX86_SOURCES} ${LIBCRYPTO_SOURCES} ${LIBCOMPRESS_SOURCES} ${LIBCRYPTO_SUBDIR_SOURCES} ${LIBTLS_SOURCES} ${LIBMARKDOWN_SOURCES} ${LIBGEMINI_SOURCES} ${LIBGFX_SOURCES} ${LIBHTTP_SOURCES} ${LAGOM_REGEX_SOURCES})
|
||||
set(LAGOM_MORE_SOURCES ${LIBELF_SOURCES} ${LIBIPC_SOURCES} ${LIBLINE_SOURCES} ${LIBJS_SOURCES} ${LIBJS_SUBDIR_SOURCES} ${LIBX86_SOURCES} ${LIBCRYPTO_SOURCES} ${LIBCOMPRESS_SOURCES} ${LIBCRYPTO_SUBDIR_SOURCES} ${LIBTLS_SOURCES} ${LIBMARKDOWN_SOURCES} ${LIBGEMINI_SOURCES} ${LIBGFX_SOURCES} ${LIBHTTP_SOURCES} ${LAGOM_REGEX_SOURCES} ${LIB_SHELL_SOURCES})
|
||||
|
||||
include_directories (../../)
|
||||
include_directories (../../Libraries/)
|
||||
|
@ -77,8 +81,8 @@ add_library(LagomCore ${LAGOM_CORE_SOURCES})
|
|||
|
||||
if (BUILD_LAGOM)
|
||||
add_library(Lagom $<TARGET_OBJECTS:LagomCore> ${LAGOM_MORE_SOURCES})
|
||||
|
||||
if (NOT ENABLE_OSS_FUZZ)
|
||||
|
||||
if (NOT ENABLE_OSS_FUZZ)
|
||||
add_executable(TestApp TestApp.cpp)
|
||||
target_link_libraries(TestApp Lagom)
|
||||
target_link_libraries(TestApp stdc++)
|
||||
|
|
|
@ -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)
|
||||
|
|
38
Meta/Lagom/Fuzzers/FuzzShell.cpp
Normal file
38
Meta/Lagom/Fuzzers/FuzzShell.cpp
Normal file
|
@ -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;
|
||||
}
|
Loading…
Reference in a new issue