1
0
mirror of https://github.com/php/php-src.git synced 2026-03-30 04:02:19 +02:00
Commit Graph

5833 Commits

Author SHA1 Message Date
Patrick Allaert
38123aca18 Update versions for PHP 8.1.31 2024-11-19 16:21:33 +01:00
Ben Ramsey
fcbcf2f281 PHP-8.1 is now for PHP 8.1.31-dev 2024-09-26 12:52:41 -05:00
Arnaud Le Blanc
d65a1e6f91 Fix GHSA-9pqp-7h25-4f32
multipart/form-data boundaries larger than the read buffer result in erroneous
parsing, which violates data integrity.

Limit boundary size, as allowed by RFC 1521:

    Encapsulation boundaries [...] must be no longer than 70 characters, not
    counting the two leading hyphens.

We correctly parse payloads with boundaries of length up to
FILLUNIT-strlen("\r\n--") bytes, so allow this for BC.
2024-09-23 11:23:13 +01:00
Ben Ramsey
a87ccc7ca2 PHP-8.1 is now for PHP 8.1.30-dev 2024-06-05 00:48:17 -05:00
Ben Ramsey
ca5fe4030c PHP-8.1 is now for PHP 8.1.29-dev 2024-04-10 00:48:59 -05:00
Niels Dossche
093c08af25 Fix GHSA-wpj3-hf5j-x4v4: __Host-/__Secure- cookie bypass due to partial CVE-2022-31629 fix
The check happened too early as later code paths may perform more
mangling rules. Move the check downwards right before adding the actual
variable.
2024-04-09 23:37:06 -05:00
Patrick Allaert
8f6610ce88 PHP-8.1 is now for PHP 8.1.28-dev
(If released one day!)
2023-12-05 15:05:00 +01:00
Ilija Tovilo
daa38dd63e Fix in-place modification of filename in php_message_handler_for_zend
php_strip_url_passwd modifies url in-place. We cannot assume from
php_message_handler_for_zend that data is a temporary, modifiable string.

Fixes oss-fuzz #64209
Closes GH-12733
2023-11-22 21:09:42 -06:00
Jakub Zelenka
e43ffb5023 Fix stream fclose_stdiocast_flush_in_progress type 2023-11-22 20:39:30 -06:00
Jakub Zelenka
a7a6151c4f Fix bug #79945: Stream wrappers in imagecreatefrompng causes segfault
Closes GH-12696
2023-11-22 20:39:30 -06:00
Ben Ramsey
55dfc29539 PHP-8.1 is now for PHP 8.1.27-dev 2023-11-07 14:28:31 -06:00
Patrick Allaert
be64db5939 PHP-8.1 is now for PHP 8.1.26-dev 2023-10-10 22:54:03 +02:00
David Carlier
d65c80031a Fix GH-12190: stream_context_create with address and port at 0.
Prior to the 8.1 rewrite, inet_aton was used for ipv4 addresses
therefore addresses like `0` passed.
For the bindto's case where both ip and port are set as such, we discard
the address binding.

Close GH-12195
2023-09-24 15:17:53 +01:00
Ben Ramsey
c1cf0026e5 PHP-8.1 is now for PHP 8.1.25-dev 2023-09-12 16:21:51 -05:00
Patrick Allaert
6e3f93f2f8 PHP-8.1 is now for PHP 8.1.24-dev 2023-08-15 21:09:58 +02:00
Ben Ramsey
6e3c520f51 PHP-8.1 is now for PHP-8.1.23-dev 2023-07-18 16:30:49 -05:00
Patrick Allaert
6c4b1e0417 PHP-8.1 is now for PHP 8.1.22-dev 2023-06-20 16:07:05 +02:00
Ben Ramsey
2f2fd06be0 PHP-8.1 is now for PHP 8.1.21-dev 2023-05-23 16:19:16 -05:00
Patrick Allaert
725f136f9a PHP-8.1 is now for PHP 8.1.20-dev 2023-04-25 16:18:30 +02:00
Niels Dossche
51faf04dbd Fix GH-10737: PHP 8.1.16 segfaults on line 597 of sapi/apache2handler/sapi_apache2.c
The TSRM keeps a hashtable mapping the thread IDs to the thread resource pointers.
It's possible that the thread disappears without us knowing, and then another thread
gets spawned some time later with the same ID as the disappeared thread.
Note that since it's a new thread the TSRM key pointer and cached pointer will be NULL.

The Apache request handler `php_handler()` will try to fetch some fields from the SAPI globals.
It uses a lazy thread resource allocation by calling `ts_resource(0);`.
This allocates a thread resource and sets up the TSRM pointers if they haven't been set up yet.

At least, that's what's supposed to happen. But since we are in a situation where the thread ID
still has the resources of the *old* thread associated in the hashtable,
the loop in `ts_resource_ex` will find that thread resource and assume the thread has been setup
already. But this is not the case since this thread is actually a new thread, just reusing the ID
of the old one, without any relation whatsoever to the old thread.
Because of this assumption, the TSRM pointers will not be setup, leading to a
NULL pointer dereference when trying to access the SAPI globals.

We can easily detect this scenario: if we're in the fallback path, and the pointer is NULL,
and we're looking for our own thread resource, we know we're actually reusing a thread ID.
In that case, we'll free up the old thread resources gracefully (gracefully because
there might still be resources open like database connection which need to be
shut down cleanly). After freeing the resources, we'll create the new resources for
this thread as if the stale resources never existed in the first place.
From that point forward, it is as if that situation never occurred.
The fact that this situation happens isn't that bad because a child process containing
threads will eventually be respawned anyway by the SAPI, so the stale thread resources
won't remain forever.

Note that we can't simply assign our own TSRM pointers to the existing
thread resource for our ID, since it was actually from a different thread
(just with the same ID!). Furthermore, the dynamically loaded extensions
have their own pointer, which is only set when their constructor is
called, so we'd have to call their constructor anyway...
I also tried to call the dtor and then the ctor again for those resources
on the pre-existing thread resource to reuse storage, but that didn't work properly
because other code doesn't expect something like that to happen, which breaks assumptions,
and this in turn caused Valgrind to (rightfully) complain about memory bugs.

Note 2: I also had to fix a bug in the core globals destruction because it
always assumed that the thread destroying them was the owning thread,
which on TSRM shutdown isn't always the case. A similar bug was fixed
recently with the JIT globals.

Closes GH-10863.
2023-04-08 16:34:07 +02:00
Ben Ramsey
d9df750b22 PHP-8.1 is now for PHP 8.1.19-dev 2023-03-29 19:51:20 -05:00
Patrick Allaert
729f006de8 PHP-8.1 is now for PHP 8.1.18-dev 2023-02-28 21:37:52 +01:00
Niels Dossche
df579adac7 Fix GH-10692: PHP crashes on Windows when an inexistent filename is executed
Fixes GH-10692

php_fopen_primary_script() does not initialize all fields of
zend_file_handle. So when it fails and when fastcgi is true, the
zend_destroy_file_handle() function will try to free uninitialized
pointers, causing a segmentation fault. Fix it by zero-initializing file
handles just like the zend_stream_init_fp() counterpart does.

Closes GH-10697.
2023-02-25 14:32:55 +00:00
Jakub Zelenka
4058d20608 Merge branch 'PHP-8.0' into PHP-8.1 2023-02-14 10:52:17 +00:00
Jakub Zelenka
716de0cff5 Introduce max_multipart_body_parts INI
This fixes GHSA-54hq-v5wp-fqgv DOS vulnerabality by limitting number of
parsed multipart body parts as currently all parts were always parsed.
2023-02-14 10:21:23 +00:00
Jakub Zelenka
e45850c195 Fix repeated warning for file uploads limit exceeding 2023-02-14 10:21:07 +00:00
Ben Ramsey
28d68f5013 PHP-8.1 is now for PHP 8.1.17-dev 2023-02-13 13:16:07 -06:00
Stanislav Malyshev
85d9278db2 Merge branch 'PHP-8.0' into PHP-8.1 2023-02-12 21:33:39 -07:00
Niels Dossche
ec10b28d64 Fix array overrun when appending slash to paths
Fix it by extending the array sizes by one character. As the input is
limited to the maximum path length, there will always be place to append
the slash. As the php_check_specific_open_basedir() simply uses the
strings to compare against each other, no new failures related to too
long paths are introduced.
We'll let the DOM and XML case handle a potentially too long path in the
library code.
2023-02-12 20:56:19 -07:00
Patrick Allaert
c47a1a260d PHP-8.1 is now for PHP 8.1.16-dev 2023-01-17 17:24:25 +01:00
Ben Ramsey
696bb385df PHP-8.1 is now for PHP 8.1.15-dev 2022-12-07 11:29:37 -06:00
Sara Golemon
ac508301c9 Bump for 8.0.27 2022-11-08 22:10:29 +00:00
Patrick Allaert
540488c74e PHP-8.1 is now for PHP 8.1.14-dev 2022-11-08 17:57:34 +01:00
Arnaud Le Blanc
ebe58459aa Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  [ci skip] NEWS
  Fix compilation warning
  Fix crash when memory limit is exceeded during generator initialization
2022-10-22 10:44:06 +02:00
Benoit
994097093c Fix compilation warning 2022-10-22 10:41:02 +02:00
Ben Ramsey
865161af33 PHP-8.1 is now for PHP 8.1.13-dev 2022-10-11 19:47:00 -04:00
Arnaud Le Blanc
d4b99542d5 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  [ci skip] NEWS
  Return immediately when FD_SETSIZE is exceeded (#9602)
2022-10-01 11:23:34 +02:00
Arnaud Le Blanc
80232de0e4 Return immediately when FD_SETSIZE is exceeded (#9602) 2022-10-01 11:20:43 +02:00
Derick Rethans
cfee252a95 Merge branch 'PHP-8.0' into PHP-8.1 2022-09-27 14:11:31 +01:00
Derick Rethans
def8c8d174 Merge branch 'PHP-7.4' into PHP-8.0 2022-09-27 14:11:14 +01:00
Sara Golemon
559da529a0 Bump for 8.0.25 2022-09-13 23:46:26 +00:00
Patrick Allaert
0f575aa698 PHP-8.1 is now for PHP 8.1.12-dev 2022-09-13 23:09:47 +02:00
Dmitry Stogov
f4afa9adc6 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Reset FG(user_stream_current_filename) at the end of request
2022-09-12 11:39:18 +03:00
Dmitry Stogov
d0b3096ff0 Reset FG(user_stream_current_filename) at the end of request
Attempt to fix oss-fuzz #51047
2022-09-12 11:38:31 +03:00
Derick Rethans
0611be4e82 Fix #81727: Don't mangle HTTP variable names that clash with ones that have a specific semantic meaning. 2022-09-09 17:10:04 +01:00
Sara Golemon
3d6ed8c852 Catch up dev version numbers 2022-08-30 12:15:27 +00:00
Jakub Zelenka
bf97b3649d Merge branch 'PHP-8.0' into PHP-8.1 2022-08-29 22:33:02 +01:00
Jakub Zelenka
3503b1daa2 Fix bug #77780: "Headers already sent" when previous connection was aborted
This change primarily splits SAPI deactivation to module and destroy
parts. The reason is that currently some SAPIs might bail out
on deactivation. One of those SAPI is PHP-FPM that can bail out on
request end if for example the connection is closed by the client
(web sever). The problem is that in such case the resources are not
freed and some values reset. The most visible impact can have not
resetting the PG(headers_sent) which can cause erorrs in the next
request. One such issue is described in #77780 bug which this fixes
and is also cover by a test in this commit. It seems reasonable
to separate deactivation and destroying of the resource which means
that the bail out will not impact it.
2022-08-29 22:25:53 +01:00
Ben Ramsey
7f26661993 PHP-8.1 is now for PHP 8.1.11-dev 2022-08-16 10:45:29 -05:00
twosee
14d71957ca Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Re-fix GH-8409: SSL handshake timeout persistent connections hanging
2022-08-14 20:14:57 +08:00