php-internal-docs
8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
fuzzer-parser.c
Go to the documentation of this file.
1
/*
2
+----------------------------------------------------------------------+
3
| Copyright (c) The PHP Group |
4
+----------------------------------------------------------------------+
5
| This source file is subject to version 3.01 of the PHP license, |
6
| that is bundled with this package in the file LICENSE, and is |
7
| available through the world-wide-web at the following url: |
8
| https://www.php.net/license/3_01.txt |
9
| If you did not receive a copy of the PHP license and are unable to |
10
| obtain it through the world-wide-web, please send a note to |
11
| license@php.net so we can mail you a copy immediately. |
12
+----------------------------------------------------------------------+
13
| Authors: Johannes Schlüter <johanes@php.net> |
14
| Stanislav Malyshev <stas@php.net> |
15
+----------------------------------------------------------------------+
16
*/
17
18
#include <
main/php.h
>
19
#include <
main/php_main.h
>
20
#include <
main/SAPI.h
>
21
#include <
ext/standard/info.h
>
22
#include <
ext/standard/php_var.h
>
23
#include <
main/php_variables.h
>
24
25
#include "
fuzzer.h
"
26
#include "
fuzzer-sapi.h
"
27
28
int
LLVMFuzzerTestOneInput
(
const
uint8_t *Data,
size_t
Size) {
29
if
(Size > 6 * 1024) {
30
/* Large inputs have a large impact on fuzzer performance and may cause stack overflows,
31
* but are unlikely to be necessary to reach new codepaths. */
32
return
0;
33
}
34
35
fuzzer_do_request_from_buffer
(
36
"fuzzer.php"
, (
const
char
*) Data, Size,
/* execute */
0,
/* before_shutdown */
NULL
);
37
38
return
0;
39
}
40
41
int
LLVMFuzzerInitialize
(
int
*argc,
char
***argv) {
42
/* Compilation will often trigger fatal errors.
43
* Use tracked allocation mode to avoid leaks in that case. */
44
putenv
(
"USE_TRACKED_ALLOC=1"
);
45
46
fuzzer_init_php
(
NULL
);
47
48
/* fuzzer_shutdown_php(); */
49
return
0;
50
}
SAPI.h
putenv
putenv(string $assignment)
Definition
basic_functions.stub.php:1945
LLVMFuzzerTestOneInput
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
Definition
fuzzer-parser.c:28
LLVMFuzzerInitialize
int LLVMFuzzerInitialize(int *argc, char ***argv)
Definition
fuzzer-parser.c:41
fuzzer_do_request_from_buffer
int fuzzer_do_request_from_buffer(char *filename, const char *data, size_t data_len, bool execute, void(*before_shutdown)(void))
Definition
fuzzer-sapi.c:240
fuzzer_init_php
int fuzzer_init_php(const char *extra_ini)
Definition
fuzzer-sapi.c:131
fuzzer-sapi.h
fuzzer.h
NULL
#define NULL
Definition
gdcache.h:45
info.h
php.h
php_main.h
php_var.h
php_variables.h
sapi
fuzzer
fuzzer-parser.c
Generated on Sat Aug 23 2025 01:46:13 for php-internal-docs by
1.13.2