add test for libfuzzer

This commit is contained in:
Yakov Olkhovskiy 2024-10-10 18:59:48 +00:00
parent c6d6ee27f4
commit 845c4a543c
5 changed files with 18 additions and 0 deletions

View File

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

View File

@ -0,0 +1 @@
add_subdirectory (test_basic_fuzzer)

View File

@ -0,0 +1 @@
This folder contains various stuff intended to test libfuzzer functionality.

View File

@ -0,0 +1 @@
add_executable (test_basic_fuzzer main.cpp)

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