127b27ec6Sopenharmony_ci/**
227b27ec6Sopenharmony_ci * Fuzz target interface.
327b27ec6Sopenharmony_ci * Fuzz targets have some common parameters passed as macros during compilation.
427b27ec6Sopenharmony_ci * Check the documentation for each individual fuzzer for more parameters.
527b27ec6Sopenharmony_ci *
627b27ec6Sopenharmony_ci * @param FUZZ_RNG_SEED_SIZE:
727b27ec6Sopenharmony_ci *        The number of bytes of the source to look at when constructing a seed
827b27ec6Sopenharmony_ci *        for the deterministic RNG. These bytes are discarded before passing
927b27ec6Sopenharmony_ci *        the data to lz4 functions. Every fuzzer initializes the RNG exactly
1027b27ec6Sopenharmony_ci *        once before doing anything else, even if it is unused.
1127b27ec6Sopenharmony_ci *        Default: 4.
1227b27ec6Sopenharmony_ci * @param LZ4_DEBUG:
1327b27ec6Sopenharmony_ci *        This is a parameter for the lz4 library. Defining `LZ4_DEBUG=1`
1427b27ec6Sopenharmony_ci *        enables assert() statements in the lz4 library. Higher levels enable
1527b27ec6Sopenharmony_ci *        logging, so aren't recommended. Defining `LZ4_DEBUG=1` is
1627b27ec6Sopenharmony_ci *        recommended.
1727b27ec6Sopenharmony_ci * @param LZ4_FORCE_MEMORY_ACCESS:
1827b27ec6Sopenharmony_ci *        This flag controls how the zstd library accesses unaligned memory.
1927b27ec6Sopenharmony_ci *        It can be undefined, or 0 through 2. If it is undefined, it selects
2027b27ec6Sopenharmony_ci *        the method to use based on the compiler. If testing with UBSAN set
2127b27ec6Sopenharmony_ci *        MEM_FORCE_MEMORY_ACCESS=0 to use the standard compliant method.
2227b27ec6Sopenharmony_ci * @param FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
2327b27ec6Sopenharmony_ci *        This is the canonical flag to enable deterministic builds for fuzzing.
2427b27ec6Sopenharmony_ci *        Changes to zstd for fuzzing are gated behind this define.
2527b27ec6Sopenharmony_ci *        It is recommended to define this when building zstd for fuzzing.
2627b27ec6Sopenharmony_ci */
2727b27ec6Sopenharmony_ci
2827b27ec6Sopenharmony_ci#ifndef FUZZ_H
2927b27ec6Sopenharmony_ci#define FUZZ_H
3027b27ec6Sopenharmony_ci
3127b27ec6Sopenharmony_ci#ifndef FUZZ_RNG_SEED_SIZE
3227b27ec6Sopenharmony_ci#  define FUZZ_RNG_SEED_SIZE 4
3327b27ec6Sopenharmony_ci#endif
3427b27ec6Sopenharmony_ci
3527b27ec6Sopenharmony_ci#include <stddef.h>
3627b27ec6Sopenharmony_ci#include <stdint.h>
3727b27ec6Sopenharmony_ci
3827b27ec6Sopenharmony_ci#ifdef __cplusplus
3927b27ec6Sopenharmony_ciextern "C" {
4027b27ec6Sopenharmony_ci#endif
4127b27ec6Sopenharmony_ci
4227b27ec6Sopenharmony_ciint LLVMFuzzerTestOneInput(const uint8_t *src, size_t size);
4327b27ec6Sopenharmony_ci
4427b27ec6Sopenharmony_ci#ifdef __cplusplus
4527b27ec6Sopenharmony_ci}
4627b27ec6Sopenharmony_ci#endif
4727b27ec6Sopenharmony_ci
4827b27ec6Sopenharmony_ci#endif
49