1*01826a49SYabin Cui /* 2*01826a49SYabin Cui * Copyright (c) Meta Platforms, Inc. and affiliates. 3*01826a49SYabin Cui * All rights reserved. 4*01826a49SYabin Cui * 5*01826a49SYabin Cui * This source code is licensed under both the BSD-style license (found in the 6*01826a49SYabin Cui * LICENSE file in the root directory of this source tree) and the GPLv2 (found 7*01826a49SYabin Cui * in the COPYING file in the root directory of this source tree). 8*01826a49SYabin Cui * You may select, at your option, one of the above-listed licenses. 9*01826a49SYabin Cui */ 10*01826a49SYabin Cui 11*01826a49SYabin Cui /** 12*01826a49SYabin Cui * Fuzz target interface. 13*01826a49SYabin Cui * Fuzz targets have some common parameters passed as macros during compilation. 14*01826a49SYabin Cui * Check the documentation for each individual fuzzer for more parameters. 15*01826a49SYabin Cui * 16*01826a49SYabin Cui * @param STATEFUL_FUZZING: 17*01826a49SYabin Cui * Define this to reuse state between fuzzer runs. This can be useful to 18*01826a49SYabin Cui * test code paths which are only executed when contexts are reused. 19*01826a49SYabin Cui * WARNING: Makes reproducing crashes much harder. 20*01826a49SYabin Cui * Default: Not defined. 21*01826a49SYabin Cui * @param DEBUGLEVEL: 22*01826a49SYabin Cui * This is a parameter for the zstd library. Defining `DEBUGLEVEL=1` 23*01826a49SYabin Cui * enables assert() statements in the zstd library. Higher levels enable 24*01826a49SYabin Cui * logging, so aren't recommended. Defining `DEBUGLEVEL=1` is 25*01826a49SYabin Cui * recommended. 26*01826a49SYabin Cui * @param MEM_FORCE_MEMORY_ACCESS: 27*01826a49SYabin Cui * This flag controls how the zstd library accesses unaligned memory. 28*01826a49SYabin Cui * It can be undefined, or 0 through 2. If it is undefined, it selects 29*01826a49SYabin Cui * the method to use based on the compiler. 30*01826a49SYabin Cui * @param FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION 31*01826a49SYabin Cui * This is the canonical flag to enable deterministic builds for fuzzing. 32*01826a49SYabin Cui * Changes to zstd for fuzzing are gated behind this define. 33*01826a49SYabin Cui * It is recommended to define this when building zstd for fuzzing. 34*01826a49SYabin Cui * @param FUZZ_THIRD_PARTY_SEQ_PROD 35*01826a49SYabin Cui * This flag allows sequence producer plugin authors to replace the built-in 36*01826a49SYabin Cui * default sequence producer with their own code. If you are not a plugin 37*01826a49SYabin Cui * author, you should not define this flag. See the docs at 38*01826a49SYabin Cui * fuzz_third_party_seq_prod.h for more information. 39*01826a49SYabin Cui */ 40*01826a49SYabin Cui 41*01826a49SYabin Cui #ifndef FUZZ_H 42*01826a49SYabin Cui #define FUZZ_H 43*01826a49SYabin Cui 44*01826a49SYabin Cui #include <stddef.h> 45*01826a49SYabin Cui #include <stdint.h> 46*01826a49SYabin Cui 47*01826a49SYabin Cui #ifdef __cplusplus 48*01826a49SYabin Cui extern "C" { 49*01826a49SYabin Cui #endif 50*01826a49SYabin Cui 51*01826a49SYabin Cui int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size); 52*01826a49SYabin Cui 53*01826a49SYabin Cui #ifdef __cplusplus 54*01826a49SYabin Cui } 55*01826a49SYabin Cui #endif 56*01826a49SYabin Cui 57*01826a49SYabin Cui #endif 58