1 /** 2 * Fuzz target interface. 3 * Fuzz targets have some common parameters passed as macros during compilation. 4 * Check the documentation for each individual fuzzer for more parameters. 5 * 6 * @param FUZZ_RNG_SEED_SIZE: 7 * The number of bytes of the source to look at when constructing a seed 8 * for the deterministic RNG. These bytes are discarded before passing 9 * the data to lz4 functions. Every fuzzer initializes the RNG exactly 10 * once before doing anything else, even if it is unused. 11 * Default: 4. 12 * @param LZ4_DEBUG: 13 * This is a parameter for the lz4 library. Defining `LZ4_DEBUG=1` 14 * enables assert() statements in the lz4 library. Higher levels enable 15 * logging, so aren't recommended. Defining `LZ4_DEBUG=1` is 16 * recommended. 17 * @param LZ4_FORCE_MEMORY_ACCESS: 18 * This flag controls how the zstd library accesses unaligned memory. 19 * It can be undefined, or 0 through 2. If it is undefined, it selects 20 * the method to use based on the compiler. If testing with UBSAN set 21 * MEM_FORCE_MEMORY_ACCESS=0 to use the standard compliant method. 22 * @param FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION 23 * This is the canonical flag to enable deterministic builds for fuzzing. 24 * Changes to zstd for fuzzing are gated behind this define. 25 * It is recommended to define this when building zstd for fuzzing. 26 */ 27 28 #ifndef FUZZ_H 29 #define FUZZ_H 30 31 #ifndef FUZZ_RNG_SEED_SIZE 32 # define FUZZ_RNG_SEED_SIZE 4 33 #endif 34 35 #include <stddef.h> 36 #include <stdint.h> 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size); 43 44 #ifdef __cplusplus 45 } 46 #endif 47 48 #endif 49