Commit Graph

5459 Commits

Author SHA1 Message Date
Christoph M. Becker
57463cf78b Drop all JIT related XFAILS from phpdbg test suite
phpdbg now disables JIT, so these cause XFAIL warnings.
2020-11-30 15:24:15 +01:00
Nikita Popov
4643c0aac5 Add additional entries to unserialize corpus
These are useful to seed typed property fuzzing.
2020-11-30 14:32:07 +01:00
Christoph M. Becker
666833b238 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #76813: Access violation near NULL on source operand
2020-11-30 12:33:13 +01:00
Christoph M. Becker
5e15c9c41f Fix #76813: Access violation near NULL on source operand
We avoid `YYCURSOR` becoming `NULL` by initializing `YYMARKER`, and add
a default rule for `<NORMAL>` where we catch unexpected input.

We also fix the only superficially related issue regarding empty input
followed by `T_SEPARATOR` and command, which caused another segfault.

Closes GH-6464.
2020-11-30 12:29:24 +01:00
Máté Kocsis
47bbfe1fc0
Require stubs to declare return types for magic methods when possible
Closes GH-6376
2020-10-23 16:33:16 +02:00
Nikita Popov
3966c0f8a4 Add test for zend_extension loading
Closes GH-6363.
2020-10-21 12:16:56 +02:00
Nikita Popov
c97da0f819 Revert "Fix bug #64865: Use CONTEXT_DOCUMENT_ROOT for scanning dir tree"
This reverts commit 98bfad738a.

This doesn't work well in some setups, see bug #80113 and GH-5051.
Reverting this for now.
2020-10-19 11:23:00 +02:00
Nikita Popov
e4e2541c1a Update to mime-db 1.45 2020-10-09 16:22:04 +02:00
Máté Kocsis
6b00196e04
Review parameter names in ext/pcre
Closes GH-6259
2020-10-02 11:55:23 +02:00
Nikita Popov
25f1c405ff Update ext/standard parameter names
Closes GH-6214.
2020-09-29 16:49:46 +02:00
Máté Kocsis
4c821cf206
Improve default value handling of Exception constructors
Closes GH-6166
2020-09-21 12:46:50 +02:00
Máté Kocsis
e950ca13ea
Consolidate the usage of "either" and "one of" in error messages
Closes GH-6173
2020-09-20 19:41:47 +02:00
Máté Kocsis
f088aec6cb
Fix UNKNOWN default value of apache_note()
Closes GH-6167
2020-09-19 16:22:18 +02:00
Nikita Popov
c5401854fc Run tidy
This should fix most of the remaining issues with tabs and spaces
being mixed in tests.
2020-09-18 14:28:32 +02:00
Nikita Popov
34bb5ba2ea Remove support for EXT_NOP
This is an annoying edge case that regularly gets broken. As we're
not aware of significant users of this API, and there are other
ways to hook this, remove support for EXT_NOP.
2020-09-18 11:03:08 +02:00
Sara Golemon
a61a9fe9a0
Support ephemeral ports in debug server 2020-09-17 14:44:07 +00:00
Máté Kocsis
6082fd33a7
Add missing param type to pcre reflection test 2020-09-15 12:47:07 +02:00
Nikita Popov
99a68775bf Fix mbstring fuzzer
mb_ereg can throw now, so we need a dummy frame and need to
free the exception afterwards.
2020-09-11 18:35:16 +02:00
twosee
bd1d11d352 Simplify error type filter
Closes GH-6049.
2020-09-10 17:36:04 +08:00
Ilija Tovilo
8a49310f4e
Adjust assignment line number for match
Otherwise the assignment will have the same number as the default arm
which will 1. mis-trigger a breakpoint and 2. mark the line as covered
even when it isn't.

Closes GH-6083
2020-09-08 00:08:18 +02:00
Nikita Popov
af0ba0b2d3 Reduce input size limit in execute fuzzer
We only have 4 Zend test cases > 8k. Large inputs tend to just
make things slower.
2020-09-07 22:58:34 +02:00
Nikita Popov
9475bcbef7 Avoid large eval inputs in fuzzer
While we limit the size of the main compilation input, the size
of eval inputs was not limited. This could result in stack
overflows, e.g. oss-fuzz #25464.
2020-09-07 11:53:01 +02:00
Nikita Popov
f5dbebd82e Accept zend_string instead of zval in zend_compile_string 2020-09-07 11:42:21 +02:00
Nikita Popov
2f95af996f Disable InfiniteIterator class while fuzzing
The combination of LimitIterator and InfiniteIterator can cause
effectively infinite loops that bypass the executor step limit.
2020-09-04 10:59:55 +02:00
Nikita Popov
05cd31ef64 Extend function blacklist in execute fuzzer
Add pfsockopen and stream_socket_server.
2020-09-02 17:30:19 +02:00
Christoph M. Becker
1902f730ee Support cli_server.color on Windows
On Windows, we have to check whether stdout is attached to a console,
and whether that console supports VT100 control codes.

Closes GH-5996
2020-08-28 18:45:09 +02:00
Nikita Popov
f0dfdca0ae Fix execute fuzzer on i386
Opcode handlers use the FASTCALL calling convention...
2020-08-28 17:03:54 +02:00
Nikita Popov
2c15c9ce80 Rehash function table after disabling functions
To perform fast shutdown without full table cleanup we need all
internal functions to be in one continuous chunk. This was
violated when functions were deleted via disable_functions.

This drops the zend_disable_function() API in favor of
zend_disable_functions(), which disables the given list of
functions and performs the necessary rehash afterwards.

Also drop PG(disabled_functions), which is no longer used.
2020-08-28 16:50:07 +02:00
Nikita Popov
bb1d0319d7 Fix typo
This was supposed to include the header, not the C file...
2020-08-27 16:57:09 +02:00
Nikita Popov
a88226d116 Generate execute corpus in generate_all.php
And add crypt() to the function blacklist, it can be very slow.
2020-08-27 16:34:36 +02:00
Nikita Popov
c29838c561 Add experimental "execute" fuzzer
This is an end-to-end fuzzer that executes arbitrary PHP code.

We replace the executor with a finite-step executor to avoid
getting stuck in loops or recursion.
2020-08-27 13:06:24 +02:00
Kees Cook
2c2bb50984 sapi/fpm/config.m4: check for libapparmor's aa_change_profile()
The fpm code actually uses aa_change_profile(), not change_hat(). Test
for the correct function. (libapparmor always has both, so this is just
a correctness fix.)

Closes GH-6037.
2020-08-24 10:10:12 +02:00
Remi Collet
8c57474e35 ensure installed ini don't interfere 2020-08-21 14:41:35 +02:00
Nikita Popov
e17ff61962 Switch to mime-db as source of extension => MIME map
The Apache MIME type map is not actively maintained anymore, so
this switches to jshttp/mime-db, which seems to be the de-facto
standard in this area now. This avoid the need to patch in our
own MIME types over time.

The preference algorithm is based on:
47b62ac45e/index.js (L154)

Closes GH-5764.
2020-08-13 12:37:33 +02:00
Nyholm
3485ec40ce Small CS fix
The comments were incorrectly aligned. Fix this by dropping the
alignment and moving the comments before the declarations.

Closes GH-5975.
2020-08-12 12:16:53 +02:00
Nikita Popov
824541d57e Disable report_zend_debug by default
We might just want to drop this completely, but at least don't
enable it by default. It already gets disabled by a number of
SAPIs, but we should make that the default state.
2020-08-12 10:36:40 +02:00
George Wang
e05439e7a4 Merge branch 'PHP-7.4' 2020-08-10 19:11:48 -04:00
George Wang
1b0a2bb0f5 Merge branch 'PHP-7.3' into PHP-7.4 2020-08-10 19:11:26 -04:00
George Wang
07cb2755be Make sure string is NUL byte terminated. 2020-08-10 19:11:03 -04:00
Nikita Popov
c439f1fa6a Fixed bug #62294
The primary issue was already resolved in 7c3e487289,
but the particular example used in this bug report ran into an
additional issue on PHP 8, because I forgot to drop a number of
zend_bailout calls when switch require failure to throw.
2020-08-10 12:54:02 +02:00
Nikita Popov
7c3e487289 Fixed bug #65275
Make EG(exit_status) the single source of truth for the exit status,
instead of having two variables that we cannot really keep
synchronized.
2020-08-10 12:40:26 +02:00
Nikita Popov
ee16316148 Fixed bug #79948
Make sure we don't execute further scripts if one of them encountered
an exit exception.

Also make sure that we free file handles that end up unused due to
an early abort in php_execute_scripts(), which turned up as an
issue in the added test case.

Finally, make use of EG(exit_status) in the places where we
zend_eval_string_ex, instead of unconditionally assigning exit
code 254. If an error occurs, the error handler will already set
exit status 255.
2020-08-10 11:15:16 +02:00
Nikita Popov
896dad4c79 Fixed bug #77561
Unconditionally strip shebang lines when using the CLI SAPI,
independently of whether they occur in the primary or non-primary
script. It's unlikely that someone intentionally wants to print
that shebang line when including a script, and this regularly
causes issues when scripts are used in multiple contexts, e.g.
for direct invocation and as a phar bootstrap.
2020-08-10 10:38:33 +02:00
Máté Kocsis
7aacc705d0
Add many missing closing PHP tags to tests
Closes GH-5958
2020-08-09 22:03:36 +02:00
Nikita Popov
8b77c58130 Accept zend_object* in zend_update_property 2020-08-07 16:40:27 +02:00
Nikita Popov
978b7de244 Accept zend_object* in zend_get_exception_base 2020-08-07 16:40:27 +02:00
Nikita Popov
7991fc2753 Accept zend_object in zend_read_property 2020-08-07 16:40:27 +02:00
Máté Kocsis
af80d8a14e
Add more argument types to stubs
Closes GH-5943
2020-08-07 12:35:30 +02:00
Nikita Popov
74b285d78c Merge branch 'PHP-7.4'
* PHP-7.4:
  Check ps -p availability in process title test
  Add privilege check in pcntl_unshare test
2020-08-05 18:18:51 +02:00
Nikita Popov
99645f5352 Check ps -p availability in process title test 2020-08-05 18:18:18 +02:00