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