Commit graph

100 commits

Author SHA1 Message Date
Jorg Adam Sowa
85b7181d7d
Added property hooks words in fuzzer parser dict (#14958) 2024-07-14 22:52:25 +02:00
Peter Kokot
dc7b67ebc3
Autotools: Sync PHP_ADD_MAKEFILE_FRAGMENT (#14766)
- Macro help text updated for extensions and general usage
- Arguments quoted
- dnl removes redundant newlines in the generated configure script
2024-07-03 13:15:13 +02:00
Peter Kokot
dc1cc503db
Autotools: Sync PHP_SUBST in sapi (#14753)
- Arguments quoted
- Redundant comments removed (some basic help info is in the
  build/php.m4)
- APXS variable as such isn't used in the generated Makefile, the path
  to the apxs tool is inserted during the configure step directly
2024-07-01 21:04:09 +02:00
Arnaud Le Blanc
11accb5cdf
Preferably include from build dir (#13516)
* Include from build dir first

This fixes out of tree builds by ensuring that configure artifacts are included
from the build dir.

Before, out of tree builds would preferably include files from the src dir, as
the include path was defined as follows (ignoring includes from ext/ and sapi/) :

    -I$(top_builddir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/main
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM
    -I$(top_builddir)/

As a result, an out of tree build would include configure artifacts such as
`main/php_config.h` from the src dir.

After this change, the include path is defined as follows:

    -I$(top_builddir)/main
    -I$(top_builddir)
    -I$(top_srcdir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM

* Fix extension include path for out of tree builds

* Include config.h with the brackets form

`#include "config.h"` searches in the directory containing the including-file
before any other include path. This can include the wrong config.h when building
out of tree and a config.h exists in the source tree.

Using `#include <config.h>` uses exclusively the include path, and gives
priority to the build dir.
2024-06-26 00:26:43 +02:00
Peter Kokot
da86eec3db
Sync #if/ifdef/defined (#14371)
These are either undefined or defined to value 1 in Autotools and
Windows:
- HAVE_COMMONCRYPTO_COMMONRANDOM_H
- HAVE_EXIF
- HAVE_FOPENCOOKIE
- HAVE_IF_NAMETOINDEX
- HAVE_LIBICONV
- HAVE_SOCKETS
- HAVE_STRUCT_STAT_ST_RDEV
- HAVE_STRUCT_TM_TM_GMTOFF
- HAVE_STRUCT_TM_TM_ZONE

Follow up of GH-5526 (-Wundef)
2024-06-07 23:45:17 +02:00
Cristian Rodríguez
8e62e2b829
Mark multple functions as static (#13864)
* Mark many functions as static

Multiple functions are missing the static qualifier.

* remove unused struct sigactions

struct sigaction act, old_term, old_quit, old_int;
all unused.

* optimizer: minXOR and maxXOR are unused
2024-05-22 13:11:46 +02:00
Peter Kokot
08e2c6fb7b
Fix fuzzer result message in configure log (#14278)
The 2nd argument of PHP_ARG_ENABLE can be a check message to avoid
manual AC_MSG_* calls.
2024-05-20 20:46:09 +02:00
Peter Kokot
ca3444b1d8
Emit error when building fuzzer with ZTS (#14273)
Thread safety (--enable-zts) is not supported when building fuzzer
(--enable-fuzzer).

Fixes GH-14243
2024-05-20 15:31:33 +02:00
Niels Dossche
14cd67a42a
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13978: Fuzzer readme still mentions obsolete --enable-json flag (#13983)
2024-04-16 22:17:59 +02:00
Niels Dossche
90388233ed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13978: Fuzzer readme still mentions obsolete --enable-json flag (#13983)
2024-04-16 22:17:42 +02:00
Niels Dossche
093d334684
Fix GH-13978: Fuzzer readme still mentions obsolete --enable-json flag (#13983)
[ci skip]
2024-04-16 22:16:51 +02:00
Dmitry Stogov
f83cdce0df Merge branch 'PHP-8.3'
* PHP-8.3:
  Wrap cleanup function call with zend_try.
2024-01-22 10:33:18 +03:00
Dmitry Stogov
9f79a98a4c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Wrap cleanup function call with zend_try.
2024-01-22 10:33:09 +03:00
Dmitry Stogov
b45e7a613f Wrap cleanup function call with zend_try.
Fizes oss-fuzz #65911
2024-01-22 10:32:04 +03:00
Jorg Adam Sowa
dd141f9e3e
add missing keywords to parser fuzzer dict from PHP 7.4 to 8.3 (#13160)
* Added missing keywords to parser fuzzer dict from PHP 7.4 to 8.3

* Added null return type
2024-01-17 01:51:42 +01:00
Peter Kokot
64751a0df0 Merge branch 'PHP-8.3'
* PHP-8.3:
  Set libtool tag per command instead of global one
2024-01-10 09:17:48 +01:00
Peter Kokot
04954f6b2c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Set libtool tag per command instead of global one
2024-01-10 09:13:39 +01:00
Jan Palus
d57a7767a2 Set libtool tag per command instead of global one
Global --tag=CC defined in configure.ac is not correct in all cases. For example
linking objects that were compiled from C++ sources needs to be done with C++
compiler, however for link mode libtool will prefer compiler indicated with
--tag.

Fixes GH-12349
2024-01-10 09:09:45 +01:00
Cristian Rodríguez
927adfb1a6
Use a single version of mempcpy(3) (#12257)
While __php_mempcpy is only used by ext/standard/crypt_sha*, the
mempcpy "pattern" is used everywhere.

This commit removes __php_mempcpy, adds zend_mempcpy and transforms
open-coded parts into function calls.
2023-12-20 15:16:32 +00:00
Alex Dowad
175b438abe Fix spurious failures of php-fuzz-mbstring 2023-11-28 21:04:17 +02:00
Dmitry Stogov
b46ed399c6 Fix php.ini (add missing "\n") 2023-11-20 11:59:47 +03:00
Daniil Gentili
df286a1b98
Improve JIT config in fuzzer SAPI (#12519)
* Improve JIT config in fuzzer SAPI

* Fix

* Fix

* Update
2023-11-14 21:26:24 +03:00
Niels Dossche
1fe7dc31ef
Fix -Wstrict-prototypes warnings in fuzzer SAPI (#11277) 2023-05-20 11:43:30 +02:00
Alex Dowad
5f2587eb25 php-fuzz-mbstring also tests text encoding validation functions
In 6fc8d014df, pakutoma added specialized validation functions for
ISO-2022-JP, JIS, UTF-7, and UTF7-IMAP text. In the future, it is
possible we might add such functions for more legacy text encodings.
Allowing them to be tested by php-fuzz-mbstring may help to catch
bugs, both now and in the future.
2023-03-27 08:17:49 +02:00
Ilija Tovilo
9d5f2f1343
Use new ZSTR_INIT_LITERAL macro (#10879) 2023-03-20 16:19:05 +01:00
Dmitry Stogov
5c5707d44d Make fuzzer respect ZEND_MMAP_AHEAD
Fixes oss-fuzz #55654
2023-02-07 13:13:05 +03:00
Alex Dowad
d5d9900661 When fuzzing mbstring encoding conversion code, compare output with different intermediate buffer sizes
Currently, php-fuzz-mbstring only confirms that no crashes (including
ASAN violations) occur when converting text from one encoding to
another.

Try performing each conversion operation with two different sizes for
the intermediate buffer which is used to pass data from the decoder to
the encoder. If the encoding conversion code is correct, the size of
that intermediate buffer shouldn't matter; we should always get exactly
the same results.

This is a much stricter test, which is more likely to catch bugs.
2023-02-05 20:04:05 +02:00
Max Kellermann
d53ad4b566 main/SAPI: make "ini_entries" a const string 2023-01-04 12:49:48 +00:00
Nikita Popov
5f0cbcff3a Don't set rpath for fuzzers
We used to use the rpath for loading libonig, but this is both no
longer needed and breaks under SystemSan.
2022-09-17 15:44:58 +02:00
Nikita Popov
828c93bedc Fix unserialize dictionary generation
We now have namespaced classes in here, and need to escape the
backslashes.
2022-07-30 17:14:22 +02:00
Alex Dowad
492021168d php_mb_convert_encoding{,_ex} returns zend_string
That's what all existing callers want anyways. This avoids 2
unnecessary copies of the converted string.
2022-05-28 21:53:39 +02:00
Alex Dowad
0154a5ac9f Use fast text conversion filters to implement php_mb_convert_encoding_ex 2022-05-28 21:53:38 +02:00
Nikita Popov
9e87be4395 Add generate_mbstring_dict.php
Forgot to git add it previously.
2022-05-09 09:13:21 +02:00
Nikita Popov
1584352e19 Add fuzzer for mb_convert_encoding
This uses the php-fuzz-mbstring name, moving the existing fuzzer
to php-fuzz-mbregex.
2022-05-08 22:34:23 +02:00
George Peter Banyard
b5db594fd2
Refacto php_module_startup() (#8303)
It only ever uses at most 1 additional modules
2022-04-27 23:07:11 +01:00
David CARLIER
20d8561ed4
fuzzer support for FreeBSD, getting opcache location
Closes GH-7926.
2022-01-18 15:04:42 +01:00
Tyson Andre
9a59417445
[skip ci] Document how to quickly check if jit .dasc files transpile, how to test the jit in different architectures. (#7768) 2021-12-19 10:12:35 -05:00
Nikita Popov
39a1cab471 Generate tracing jit corpus in generate_all.php
Using same corpus as function jit. To allow oss-fuzz integration.
2021-10-11 14:33:11 +02:00
Nikita Popov
5d05f810d0 Reduce max input size in parser fuzzer
Still seeing stack overflows for $$$$$x style input, let's reduce
the input size limit further...
2021-10-06 19:14:20 +02:00
codinghuang
5bda4cd25a Support specifying start position in compile_string
Add additional zend_compile_position argument, which can be either
AT_SHEBANG, AT_OPEN_TAG or AFTER_OPEN_TAG. The previous behavior
corresponds to AFTER_OPEN_TAG.

Closes GH-7462.
2021-09-30 10:21:33 +02:00
Nikita Popov
83fccc68d7 Consistently set bailed_out flag
It was not set for some of the bailouts, resulting in timeouts
in the function JIT fuzzer.

Fixes oss-fuzz #39293.
2021-09-28 12:16:22 +02:00
Nikita Popov
a12aee5cb3 Fix opcache path determination, again
We shouldn't be appending to the executable path, but rather to
the directory of the executable.
2021-09-24 16:27:44 +02:00
Nikita Popov
b732b6d06f Try to fetch opcache.so path relative to binary
While the cwd-relative lookup worked for the oss-fuzz docker images,
it doesn't seem to work on the cluster infrastructure. Try finding
opcache.so relative to the binary instead.
2021-09-23 16:44:03 +02:00
Nikita Popov
40aa6b63d1 Further limit max input size in parser fuzzer
It's easy to cause stack overflows with degenerate cases like
"$$$$$x" repeated thousands of times. We have no interest in
addressing these.

Make the input size smaller to hopefully avoid these stack
overflows.
2021-09-23 13:11:21 +02:00
Nikita Popov
b7409d3a63 Disable chdir in execute fuzzers
We don't want the current working directory to change during
fuzzing, as that breaks corpus access unless an absolute path is
used. I'm not sure why this issue never came up before.
2021-09-22 12:58:20 +02:00
Nikita Popov
831a2b3c3d Disable custom execute_ex during function JIT fuzzing as well
Having zend_execute_ex set is normally not a problem for the
function JIT, but there is an edge case leak due to special
RELEASE_THIS handling during generator creation. As this is an
unsupported mode of operation, reset to the original handler
for the function jit fuzzer as well.
2021-09-22 12:48:52 +02:00
Nikita Popov
b3d37e9c91 Generate function-jit corpus in generate_all.php
For use by oss-fuzz.
2021-09-22 11:06:22 +02:00
Nikita Popov
9d0c018668 Make sure dummy file for fuzzing exists 2021-09-22 10:58:25 +02:00
Nikita Popov
06a25c774d Add fuzzer for tracing jit 2021-09-22 10:32:46 +02:00
Nikita Popov
cd4243dde9 Add fuzzer for function JIT
This is a basic fuzzer for the function JIT, which looks for
crashes and sanitizer violations only, and does not try to detect
differing behavior yet.
2021-09-15 17:12:39 +02:00