/src/php-src/sapi/fuzzer/fuzzer-execute.c
Line | Count | Source |
1 | | /* |
2 | | +----------------------------------------------------------------------+ |
3 | | | Copyright © The PHP Group and Contributors. | |
4 | | +----------------------------------------------------------------------+ |
5 | | | This source file is subject to the Modified BSD License that is | |
6 | | | bundled with this package in the file LICENSE, and is available | |
7 | | | through the World Wide Web at <https://www.php.net/license/>. | |
8 | | | | |
9 | | | SPDX-License-Identifier: BSD-3-Clause | |
10 | | +----------------------------------------------------------------------+ |
11 | | | Authors: Nikita Popov <nikic@php.net> | |
12 | | +----------------------------------------------------------------------+ |
13 | | */ |
14 | | |
15 | | #include "fuzzer-execute-common.h" |
16 | | |
17 | 33.5k | int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { |
18 | 33.5k | if (Size > MAX_SIZE) { |
19 | | /* Large inputs have a large impact on fuzzer performance, |
20 | | * but are unlikely to be necessary to reach new codepaths. */ |
21 | 1 | return 0; |
22 | 1 | } |
23 | | |
24 | 33.5k | steps_left = MAX_STEPS; |
25 | 33.5k | fuzzer_do_request_from_buffer( |
26 | 33.5k | FILE_NAME, (const char *) Data, Size, /* execute */ 1, /* before_shutdown */ NULL); |
27 | | |
28 | 33.5k | return 0; |
29 | 33.5k | } |
30 | | |
31 | 2 | int LLVMFuzzerInitialize(int *argc, char ***argv) { |
32 | | fuzzer_init_php_for_execute(NULL); |
33 | 2 | return 0; |
34 | 2 | } |