File tree 3 files changed +33
-1
lines changed
3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,9 @@ add_subdirectory(unittests)
26
26
set (targets evmone-bench evmone-bench-internal evmone-eofparse evmone-state evmone-statetest evmone-t8n evmone-unittests testutils)
27
27
28
28
if (EVMONE_FUZZING)
29
+ add_subdirectory (eofparsefuzz)
29
30
add_subdirectory (fuzzer)
30
- list (APPEND targets evmone-fuzzer)
31
+ list (APPEND targets evmone-eofparsefuzz evmone- fuzzer)
31
32
endif ()
32
33
33
34
set_target_properties (
Original file line number Diff line number Diff line change
1
+ # evmone-fuzzer: LibFuzzer based testing tool for EVMC-compatible EVM implementations.
2
+ # Copyright 2023 The evmone Authors.
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ get_target_property (type evmone TYPE )
6
+ if (NOT type STREQUAL STATIC_LIBRARY)
7
+ message (FATAL_ERROR "The evmone must be built as static library" )
8
+ endif ()
9
+
10
+ if (fuzzing_coverage)
11
+ set (CMAKE_EXE_LINKER_FLAGS "-fsanitize=fuzzer" )
12
+ else ()
13
+ string (REPLACE fuzzer-no -link fuzzer CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} )
14
+ endif ()
15
+
16
+ add_executable (evmone-eofparsefuzz eofparsefuzz.cpp)
17
+ target_link_libraries (evmone-eofparsefuzz PRIVATE evmone)
18
+ target_include_directories (evmone-eofparsefuzz PRIVATE ${evmone_private_include_dir} )
Original file line number Diff line number Diff line change
1
+ // evmone-fuzzer: LibFuzzer based testing tool for EVMC-compatible EVM implementations.
2
+ // Copyright 2019 The evmone Authors.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+
5
+ #include < evmone/eof.hpp>
6
+
7
+ extern " C" int LLVMFuzzerTestOneInput (const uint8_t * data, size_t data_size) noexcept
8
+ {
9
+ const evmone::bytes_view eof{data, data_size};
10
+ if (evmone::validate_eof (EVMC_CANCUN, eof) == evmone::EOFValidationError::success)
11
+ (void )evmone::read_valid_eof1_header (eof.begin ());
12
+ return 0 ;
13
+ }
You can’t perform that action at this time.
0 commit comments