1
0
mirror of https://github.com/php/php-src.git synced 2026-04-27 10:16:41 +02:00
Commit Graph

17768 Commits

Author SHA1 Message Date
Daniel Scherzer ea75635f1d Update versions for PHP 8.5.2 2026-01-13 13:40:53 -08:00
Bob Weinand f754ffa8b2 Fixed bug GH-20745 ("Casting out of range floats to int" applies to strings) (#20746)
This reverts the warning for float-strings, to whose it never should have been applied in the first place.
2025-12-29 21:29:08 +01:00
Niels Dossche 42f51528da Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix OOB gzseek() causing assertion failure
2025-12-28 00:22:12 +01:00
Niels Dossche dabcd74524 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix OOB gzseek() causing assertion failure
2025-12-28 00:21:56 +01:00
Niels Dossche 2709ebc0ce Fix OOB gzseek() causing assertion failure
Closes GH-20785.
2025-12-28 00:21:32 +01:00
Niels Dossche 4ed8fce458 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20582: Heap Buffer Overflow in iptcembed
2025-12-26 22:44:35 +01:00
Niels Dossche 48b4289dff Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20582: Heap Buffer Overflow in iptcembed
2025-12-26 22:44:14 +01:00
Niels Dossche 99ed66b49f Fix GH-20582: Heap Buffer Overflow in iptcembed
If you can extend the file between the file size gathering (resulting in
a buffer allocation), and reading / writing to the file you can trigger a
TOC-TOU where you write out of bounds.
To solve this, add extra bound checks and make sure that write actions
always fail when going out of bounds.
The easiest way to trigger this is via a pipe, which is used in the
test, but it should be possible with a regular file and a quick race
condition as well.

Closes GH-20591.
2025-12-26 22:43:45 +01:00
Niels Dossche 31ae40d5e1 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20444: Dom\XMLDocument::C14N() seems broken compared to DOMDocument::C14N()
2025-12-26 22:28:51 +01:00
Niels Dossche 40c291cf93 Fix GH-20444: Dom\XMLDocument::C14N() seems broken compared to DOMDocument::C14N()
C14N code expects namespace to be in-tree, but we store namespaces in a
different way out-of-tree to avoid reconciliations that break the tree
structure in a way unexpected by the DOM spec. In the DOM spec,
namespace nodes don't exist; they're regular attributes.
To solve this, we temporarily make fake namespace nodes that we later
remove.

Closes GH-20457.
2025-12-26 22:27:25 +01:00
Gina Peter Banyard 9de37a33a6 Merge branch 'PHP-8.4' into PHP-8.5 2025-12-25 19:43:44 +01:00
Gina Peter Banyard 20f9772063 ext/standard: Fix memory leak in mail() when header key is numeric
Closes GH-20776
2025-12-25 19:42:31 +01:00
David Carlier 37fe144333 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/pcntl: fix pcntl_getcpuaffinity() for solaris.
2025-12-24 16:10:34 +00:00
David Carlier 5faa54d93b ext/pcntl: fix pcntl_getcpuaffinity() for solaris.
trusting the call to handle invalid process id via errnos.

see https://github.com/php/php-src/pull/20709#discussion_r2630221301 for
rationale.

close GH-20731
2025-12-24 16:10:13 +00:00
Niels Dossche ded206ee16 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix NEWS formatting
2025-12-24 13:30:09 +01:00
Niels Dossche 7f56d4a23f Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix NEWS formatting
2025-12-24 13:29:45 +01:00
Niels Dossche 494dd97521 Fix NEWS formatting 2025-12-24 13:29:23 +01:00
Niels Dossche 13d63d6105 Fix GH-20771: Assertion failure when getUnicodeHost() returns empty string
If nothing was added to a smart_str, the interned empty string is
returned, and therefore ZVAL_NEW_STR is wrong as it'll set the
REFCOUNTED flag.

Closes GH-20773.
2025-12-23 23:17:53 +01:00
Michael Orlitzky 0eb6a4d32f ext/session/mod_mm.c: add a few missing ZSTR macros
In eaee504c the session's save_path global was changed to a
zend_string pointer, but there are a few direct char-pointer accesses
in ext/session/mod_mm.c that slipped through the cracks. GCC-15
notices them and fails to build due to the incompatible pointer types.
Three ZSTR_* wrappers are all that is needed.

Gentoo-Bug: https://bugs.gentoo.org/967862

Closes GH-20772.
2025-12-23 23:17:07 +01:00
David Carlier 250fd02851 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/posix: (Further) fix groups array creation on macos.
2025-12-22 12:54:36 +00:00
David Carlier e63dae2941 ext/posix: (Further) fix groups array creation on macos.
With macos Tahoe and clang "17.0.0" (Xcode) the ext/posix/tests/posix_getgrgid_macosx.phpt test crashes as follow:

ext/posix/posix.c:681:19: runtime error: load of misaligned address 0x60800000e972 for type 'char **', which requires 8 byte alignment
0x60800000e972: note: pointer points here
70 00  2a 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00
seems memcpy had been translated to a load instruction ?
anyhow, we force to copy a "proper" char * source.

close GH-20744
2025-12-22 12:53:53 +00:00
Niels Dossche 27d4e2f302 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix bug #74154: Phar extractTo creates empty files
2025-12-22 12:19:47 +01:00
Niels Dossche e90b48c8e5 Fix bug #74154: Phar extractTo creates empty files
The current code causes the phar entry to remain in the fname cache.
This would be fine for uncompressed phars, but is a problem for
compressed phars when they try to reopen the file pointer.
The reopen code will try to use the compressed file pointer as if it
were an uncompressed file pointer. In that case, for the given test, the
file offsets are out of bounds for the compressed file pointer because
they are the uncompressed offsets. This results in empty files.
In other cases, it's possible to read compressed parts of the file that don't
belong to that particular file.
To solve this, we simply remove the phar entry from the fname cache if
the file pointer was closed but the phar is compressed. This will make
sure that reopening the phar will not go through the cache and instead
opens up a fresh file pointer with the right decompression settings.

Closes GH-20754.
2025-12-22 12:19:21 +01:00
Niels Dossche b81f770d39 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  intl: Fix leak in umsg_format_helper()
2025-12-22 12:18:14 +01:00
Niels Dossche 10bbd9590b Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  intl: Fix leak in umsg_format_helper()
2025-12-22 12:12:42 +01:00
Niels Dossche 9a7c09c963 intl: Fix leak in umsg_format_helper()
Closes GH-20756.
2025-12-22 12:06:59 +01:00
Niels Dossche 006788b9ef Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Use EVP_MD_CTX_destroy() instead of EVP_MD_CTX_free() for compatibility and consistency
2025-12-21 22:29:37 +01:00
Niels Dossche 9cde911350 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Use EVP_MD_CTX_destroy() instead of EVP_MD_CTX_free() for compatibility and consistency
2025-12-21 22:29:19 +01:00
Giovanni Giacobbi f89a3503bf Use EVP_MD_CTX_destroy() instead of EVP_MD_CTX_free() for compatibility and consistency
Closes GH-20748.
2025-12-21 22:28:57 +01:00
Niels Dossche 38e8aca77d Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  phar: Fix SplFileInfo::openFile() in write mode
2025-12-21 13:18:39 +01:00
Niels Dossche cf4e8e0ef6 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  phar: Fix SplFileInfo::openFile() in write mode
2025-12-21 13:18:23 +01:00
Niels Dossche efde160ef4 phar: Fix SplFileInfo::openFile() in write mode
This stopped working after e735d2bc3b because fp_refcount is increased,
making phar think that the file has open read pointers.
To fix this, the refcount shouldn't be increased but that would
re-introduce the previous bug.
Instead, we need to add a field that "locks" the existence of the
internal entry separate from the refcount.

Closes GH-20473.
2025-12-21 13:17:54 +01:00
Niels Dossche 66d4441217 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20732: Phar::LoadPhar undefined behavior when loading directory
2025-12-20 11:16:30 +01:00
Niels Dossche 9686936378 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20732: Phar::LoadPhar undefined behavior when loading directory
2025-12-20 11:16:13 +01:00
Niels Dossche 22aaa20dab Fix GH-20732: Phar::LoadPhar undefined behavior when loading directory
The size of `got` was incorrect: it being unsigned means that the error
return codes are converted from -1 to SIZE_MAX. We should use ssize_t
instead.

Closes GH-20735.
2025-12-20 11:15:47 +01:00
Niels Dossche c35224e11c Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20352: UAF in php_output_handler_free via re-entrant ob_start() during error deactivation
2025-12-19 19:37:11 +01:00
Niels Dossche 0590a34aee Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20352: UAF in php_output_handler_free via re-entrant ob_start() during error deactivation
2025-12-19 19:36:53 +01:00
Niels Dossche ee0143887d Fix GH-20352: UAF in php_output_handler_free via re-entrant ob_start() during error deactivation
The problem is that the code is doing `php_output_handler_free` in a loop on the output stack,
but prior to freeing the pointer on the stack in `php_output_handler_free` it calls
`php_output_handler_dtor` which can run user code that reallocates the stack,
resulting in a dangling pointer freed by php_output_handler_free.
Furthermore, OG(active) is set when creating a new output handler, but
the loop is supposed to clean up all handlers, so OG(active) must be
reset as well.

Closes GH-20356.
2025-12-19 19:36:26 +01:00
Niels Dossche 735f354ac9 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20722: Null pointer dereference in DOM namespace node cloning via clone on malformed objects
2025-12-18 22:40:12 +01:00
Niels Dossche bf63341f35 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20722: Null pointer dereference in DOM namespace node cloning via clone on malformed objects
2025-12-18 22:39:57 +01:00
Niels Dossche 983be089c0 Fix GH-20722: Null pointer dereference in DOM namespace node cloning via clone on malformed objects
Closes GH-20730.
2025-12-18 22:39:35 +01:00
Ilija Tovilo 99691b470a Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix uncatchable exception thrown in generator
2025-12-16 17:30:55 +01:00
Ilija Tovilo acff8f014c Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix uncatchable exception thrown in generator
2025-12-16 17:30:35 +01:00
Ilija Tovilo fb1ec9a5a7 Fix uncatchable exception thrown in generator
This procedure may be called during i_free_compiled_variables(), when
EG(current_execute_data) is unfortunately already reset to the parent frame.
EG(opline_before_exception) does not actually belong to this frame. Furthermore,
setting opline to EG(exception_op) early will miss a later
zend_rethrow_exception(), which will also miss installation of the correct
EG(opline_before_exception).

Fixes GH-20714
Closes GH-20716
2025-12-16 17:30:05 +01:00
Jakub Zelenka 5c0a6feca2 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Update NEWS with info about security issues
  Fix GHSA-www2-q4fc-65wf
  Fix GHSA-h96m-rvf9-jgm2
  Fix GHSA-8xr5-qppj-gvwj: PDO quoting result null deref
  Fix GH-20584: Information Leak of Memory
2025-12-16 15:36:52 +01:00
Jakub Zelenka 633fb48fca Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Update NEWS with info about security issues
  Fix GHSA-www2-q4fc-65wf
  Fix GHSA-h96m-rvf9-jgm2
  Fix GHSA-8xr5-qppj-gvwj: PDO quoting result null deref
  Fix GH-20584: Information Leak of Memory
2025-12-16 15:35:25 +01:00
Jakub Zelenka e776695abf Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Update NEWS with info about security issues
  Fix GHSA-www2-q4fc-65wf
  Fix GHSA-h96m-rvf9-jgm2
  Fix GHSA-8xr5-qppj-gvwj: PDO quoting result null deref
  Fix GH-20584: Information Leak of Memory
2025-12-16 15:34:19 +01:00
Jakub Zelenka 6e124d0df6 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Update NEWS with info about security issues
  Fix GHSA-www2-q4fc-65wf
  Fix GHSA-h96m-rvf9-jgm2
  Fix GHSA-8xr5-qppj-gvwj: PDO quoting result null deref
  Fix GH-20584: Information Leak of Memory
2025-12-16 15:30:54 +01:00
Jakub Zelenka c48a9f42d3 Update NEWS with info about security issues 2025-12-16 15:26:59 +01:00
Niels Dossche 21fe7149e7 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20695: Assertion failure in normalize_value() when parsing malformed INI input via parse_ini_string()
2025-12-15 22:47:07 +01:00