Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/bc/include/ossfuzz.h
39534 views
1
/*
2
* *****************************************************************************
3
*
4
* SPDX-License-Identifier: BSD-2-Clause
5
*
6
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
7
*
8
* Redistribution and use in source and binary forms, with or without
9
* modification, are permitted provided that the following conditions are met:
10
*
11
* * Redistributions of source code must retain the above copyright notice, this
12
* list of conditions and the following disclaimer.
13
*
14
* * Redistributions in binary form must reproduce the above copyright notice,
15
* this list of conditions and the following disclaimer in the documentation
16
* and/or other materials provided with the distribution.
17
*
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
* POSSIBILITY OF SUCH DAMAGE.
29
*
30
* *****************************************************************************
31
*
32
* Declarations for the OSS-Fuzz build of bc and dc.
33
*
34
*/
35
36
#include <stdint.h>
37
#include <stdlib.h>
38
39
#ifndef BC_OSSFUZZ_H
40
#define BC_OSSFUZZ_H
41
42
/// The number of args in fuzzer arguments, including the NULL terminator.
43
extern const size_t bc_fuzzer_args_len;
44
45
/// The standard arguments for the bc fuzzer with the -c argument.
46
extern const char* bc_fuzzer_args_c[];
47
48
/// The standard arguments for the bc fuzzer with the -C argument.
49
extern const char* bc_fuzzer_args_C[];
50
51
/// The standard arguments for the dc fuzzer with the -c argument.
52
extern const char* dc_fuzzer_args_c[];
53
54
/// The standard arguments for the dc fuzzer with the -C argument.
55
extern const char* dc_fuzzer_args_C[];
56
57
/// The data pointer.
58
extern uint8_t* bc_fuzzer_data;
59
60
/**
61
* The function that the fuzzer runs.
62
* @param Data The data.
63
* @param Size The number of bytes in @a Data.
64
* @return 0 on success, -1 on error.
65
* @pre @a Data must not be equal to NULL if @a Size > 0.
66
*/
67
int
68
LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size);
69
70
/**
71
* The initialization function for the fuzzer.
72
* @param argc A pointer to the argument count.
73
* @param argv A pointer to the argument list.
74
* @return 0 on success, -1 on error.
75
*/
76
int
77
LLVMFuzzerInitialize(int* argc, char*** argv);
78
79
#endif // BC_OSSFUZZ_H
80
81