php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
fuzzer-unserialize.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 +----------------------------------------------------------------------+
15 */
16
17
18#include "fuzzer.h"
19
20#include "Zend/zend.h"
21#include <main/php_config.h>
22#include "main/php_main.h"
23
24#include <stdio.h>
25#include <stdint.h>
26#include <stdlib.h>
27
28#include "fuzzer-sapi.h"
29
31
32int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
33
35 return 0;
36 }
37
38 unsigned char *orig_data = malloc(Size+1);
39 memcpy(orig_data, Data, Size);
40 orig_data[Size] = '\0';
41
43
44 {
45 const unsigned char *data = orig_data;
48
51 php_var_unserialize(&result, (const unsigned char **) &data, data + Size, &var_hash);
53
55 }
56
57 free(orig_data);
58
60 return 0;
61}
62
63int LLVMFuzzerInitialize(int *argc, char ***argv) {
65
66 /* fuzzer_shutdown_php(); */
67 return 0;
68}
memcpy(ptr1, ptr2, size)
int fuzzer_request_startup(void)
void fuzzer_setup_dummy_frame(void)
void fuzzer_request_shutdown(void)
int fuzzer_init_php(const char *extra_ini)
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
int LLVMFuzzerInitialize(int *argc, char ***argv)
#define NULL
Definition gdcache.h:45
#define PHP_VAR_UNSERIALIZE_DESTROY(d)
Definition php_var.h:59
struct php_unserialize_data * php_unserialize_data_t
Definition php_var.h:32
#define PHP_VAR_UNSERIALIZE_INIT(d)
Definition php_var.h:56
PHPAPI int php_var_unserialize(zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash)
zend_constant * data
php_unserialize_data_t var_hash
Definition session.c:964
struct _zval_struct zval
#define ZVAL_UNDEF(z)
@ FAILURE
Definition zend_types.h:61
ZEND_API void zval_ptr_dtor(zval *zval_ptr)
bool result