mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-14 19:45:11 +00:00
add test for libfuzzer
This commit is contained in:
parent
c6d6ee27f4
commit
845c4a543c
@ -23,3 +23,7 @@ if (ENABLE_UTILS)
|
||||
add_subdirectory (keeper-data-dumper)
|
||||
add_subdirectory (memcpy-bench)
|
||||
endif ()
|
||||
|
||||
if (ENABLE_FUZZING)
|
||||
add_subdirectory (libfuzzer-test)
|
||||
endif ()
|
||||
|
1
utils/libfuzzer-test/CMakeLists.txt
Normal file
1
utils/libfuzzer-test/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
add_subdirectory (test_basic_fuzzer)
|
1
utils/libfuzzer-test/README.md
Normal file
1
utils/libfuzzer-test/README.md
Normal file
@ -0,0 +1 @@
|
||||
This folder contains various stuff intended to test libfuzzer functionality.
|
1
utils/libfuzzer-test/test_basic_fuzzer/CMakeLists.txt
Normal file
1
utils/libfuzzer-test/test_basic_fuzzer/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
add_executable (test_basic_fuzzer main.cpp)
|
11
utils/libfuzzer-test/test_basic_fuzzer/main.cpp
Normal file
11
utils/libfuzzer-test/test_basic_fuzzer/main.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
if (size > 0 && data[0] == 'H')
|
||||
if (size > 1 && data[1] == 'I')
|
||||
if (size > 2 && data[2] == '!')
|
||||
__builtin_trap();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user