Commit graph

139814 commits

Author SHA1 Message Date
Jakub Zelenka
80637d11b3
Update NEWS with entries for security fixes 2025-07-02 09:00:09 +09:00
Gina Peter Banyard
758e1e3192
ext/dom: Fix new MSVC compiler warning
Closes GH-18889
2025-07-02 09:00:09 +09:00
Ahmed Lekssays
158aa14167
Fix GHSA-453j-q27h-5p8x
Libxml versions prior to 2.13 cannot correctly handle a call to
xmlNodeSetName() with a name longer than 2G. It will leave the node
object in an invalid state with a NULL name. This later causes a NULL
pointer dereference when using the name during message serialization.

To solve this, implement a workaround that resets the name to the
sentinel name if this situation arises.

Versions of libxml of 2.13 and higher are not affected.

This can be exploited if a SoapVar is created with a fully qualified
name that is longer than 2G. This would be possible if some application
code uses a namespace prefix from an untrusted source like from a remote
SOAP service.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2025-07-02 09:00:09 +09:00
Jakub Zelenka
2e37a4d8aa
Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
This adds error checks for escape function is pgsql and pdo_pgsql
extensions. It prevents possibility of storing not properly escaped
data which could potentially lead to some security issues.
2025-07-02 09:00:08 +09:00
Jakub Zelenka
9234b0d62c
Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
This fixes stream_socket_client() and fsockopen().

Specifically it adds a check to parse_ip_address_ex and it also makes
sure that the \0 is not ignored in fsockopen() hostname formatting.
2025-07-02 09:00:08 +09:00
Niels Dossche
f8e2adfe91
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-14551: PGO build fails with xxhash
2025-06-12 19:26:56 +02:00
Niels Dossche
afb1c57470
Fix GH-14551: PGO build fails with xxhash
Turns out that the instrumentation added for gcov can change inlining
decisions of the compiler, which results in a mismatch between the
profile data CFG and the actual generated CFG between compiles.

There are two functions that suffer from this issue:
1. _PHP_XXH3_Init: Removing the inline hint fixes this one. In fact,
   always inlining this makes no sense as there's no real opportunity
   for specialising. It just bloats the binary and increases I$ pressure.
   So besides fixing this issue it's beneficial on its own to drop the
   attribute.
2. PHP_XXH3_128_Final: Sometimes XXH128_canonicalFromHash gets inlined
   and sometimes not. Make sure it gets always inlined.

Closes GH-18814.
2025-06-12 19:26:28 +02:00
Niels Dossche
6685414a77
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix 'phpdbg --help' segfault on shutdown with USE_ZEND_ALLOC=0
2025-06-10 19:22:56 +02:00
Niels Dossche
0cd3ebfc40
Fix 'phpdbg --help' segfault on shutdown with USE_ZEND_ALLOC=0
This hack not only breaks the handling of custom allocators, but also
breaks if zend_alloc is compiled with USE_CUSTOM_MM.
This hack is just no good, if you want leak information then use ASAN.

Closes GH-18813.
2025-06-10 19:22:24 +02:00
Tim Düsterhus
594221fff2
cli: Fix tests/bug80092.phpt expectation for PHP_BUILD_PROVIDER (#18824)
see afc5738154
see 40d88cacc1
2025-06-10 19:15:35 +02:00
Niels Dossche
4f233e3ba2
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix technically incorrect sizeof
2025-06-09 22:05:21 +02:00
Niels Dossche
fe3bea090e
Fix technically incorrect sizeof
This doesn't actually matter because both `*sal` and `**sal` are pointer
sized, but this makes analysers happy.
Fixes bug #68866.

Closes GH-18816.
2025-06-09 22:05:09 +02:00
Niels Dossche
fc89d1968c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  zend_alloc: Fix compile with ZEND_MM_STAT=0
2025-06-09 17:28:06 +02:00
Niels Dossche
d11f9717fd
zend_alloc: Fix compile with ZEND_MM_STAT=0
Closes GH-18811.
2025-06-09 17:27:39 +02:00
Niels Dossche
d6258d60d6
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix test conflict between copy_variation2-win32-mb.phpt and copy_variation2-win32.phpt
2025-06-09 14:16:32 +02:00
Niels Dossche
186a8116be
Fix test conflict between copy_variation2-win32-mb.phpt and copy_variation2-win32.phpt
Closes GH-18809.
2025-06-09 14:16:18 +02:00
Niels Dossche
7a0beb4867
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18743: Incompatibility in Inline TLS Assembly on Alpine 3.22
2025-06-09 11:41:02 +02:00
Niels Dossche
b3c8afe272
Fix GH-18743: Incompatibility in Inline TLS Assembly on Alpine 3.22
GAS started checking the relocation for tlsgd: it must use the %rdi
register. However, the inline assembly now uses %rax instead.
Fix it by changing the "=a" output register to "=D".
Source: ec181e1710/gas/config/tc-i386.c (L6793)

gottpoff is unaffected.

Closes GH-18779.
2025-06-09 11:39:34 +02:00
Niels Dossche
5526301908
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  pdo_odbc: Fix memory leak if WideCharToMultiByte() fails
  Fix memory leak on php_odbc_fetch_hash() failure
  Do not delete main chunk in zend_gc
2025-06-09 11:25:41 +02:00
Niels Dossche
786090b35d
pdo_odbc: Fix memory leak if WideCharToMultiByte() fails
Closes GH-18788.
2025-06-09 11:24:48 +02:00
Niels Dossche
ef92e06de1
Fix memory leak on php_odbc_fetch_hash() failure
The array is initialized but not freed.

Closes GH-18787.
2025-06-09 11:24:13 +02:00
Daniil Gentili
9a9d98e02f
Do not delete main chunk in zend_gc
Closes GH-18756.

Co-authored-by: Arnaud Le Blanc <arnaud.lb@gmail.com>
2025-06-09 11:23:29 +02:00
David Carlier
1044558b64
ext/pdo_sqlite: createCollation memory leaks fix.
coming from callback arguments when its return type is incorrect.

close GH-18796
2025-06-07 14:28:29 +01:00
Jakub Zelenka
c772963c9c
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-06 13:54:25 +02:00
Peter Kokot
ae92b85572
Fix linking ext/curl against OpenSSL (#13262)
This is backport for 8.3 of b222c020bf
that originally targeted only 8.4+. This is however a bug fix.

Following 68f6ab7113, the ext/curl doesn't
need to be linked against OpenSSL anymore, if curl_version_info_data
ssl_version is OpenSSL/1.1 or later.

With OpenSSL 3 and later the check for old SSL crypto locking callbacks
was detected here.

This also uses a common PHP_SETUP_OPENSSL macro for checking OpenSSL and
syncs the minimum OpenSSL version (currently 1.0.2 or later) across the
PHP build system.
2025-06-06 13:51:21 +02:00
Niels Dossche
976143e365
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix compile without ZEND_MM_STORAGE
2025-06-05 21:51:38 +02:00
Niels Dossche
4162c20787
Fix compile without ZEND_MM_STORAGE 2025-06-05 21:51:30 +02:00
Jakub Zelenka
7a15d2a5c0
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-05 18:05:24 +02:00
Jakub Zelenka
444cc78a3e
Skip OpenSSL proxy test for bug #74796 on Windows 2025-06-05 16:18:06 +02:00
Jakub Zelenka
086a470208
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-05 14:10:57 +02:00
Jakub Zelenka
42f6c15186
Fix bug #74796: Requests through http proxy set peer name
This issue happens because http wrapper sets peer_name but then does not
remove so it stays in the context. The fix removes the peer name from
the context after enabling crypto.

In addition to bug #74796, this also fixes bug #76196.

In addition it should be a final fix for those SOAP bugs:

bug #69783
bug #52913
bug #61463
2025-06-05 14:08:28 +02:00
David Carlier
ecc9393b36
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-04 20:35:17 +01:00
David Carlier
e13ba36abb
ext/tidy: anticipate tidyOptIsReadOnly retirement.
using tidyOptGetCategory when possible.

related GH-18751

close GH-18763
2025-06-04 20:32:21 +01:00
Niels Dossche
2b383848a7
Fix handling of references in zval_try_get_long()
This API can't handle references, yet everyone keeps forgetting that it
can't and that you should DEREF upfront. Fix every type of this issue
once and for all by moving the reference handling to this Zend API.

Closes GH-18761.
2025-06-04 21:00:05 +02:00
Niels Dossche
111072a9f0
Fix GH-18744: PHP 8.4 classList works not correctly if copy HTMLElement by clone keyword.
The $classList property is special in the sense that it's a cached
object instance per (HTML)Element instance. The reason for this design
is because it has the [[SameObject]] IDL attribute.
Cloning in PHP also clones the properties, so it also clones the cached
instance. To solve this, we undo this by resetting the backing storage.

Closes GH-18749.
2025-06-04 18:59:05 +02:00
Niels Dossche
87ff5479fc
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak of X509_STORE in php_openssl_setup_verify() on failure
2025-06-03 23:46:21 +02:00
Niels Dossche
08a9579883
Fix memory leak of X509_STORE in php_openssl_setup_verify() on failure
Closes GH-18750.
2025-06-03 23:45:51 +02:00
Dmitry Stogov
81593cfc6a
Update IR
IR commit: e4343be0082897510c40a1b57baff427c6858878
2025-06-02 09:23:39 +03:00
Nikita Popov
d66e87b02e Fix line assignment in zend_ast_create_va()
The intent here was to assign the first found line. Instead this
always fell back to CG(zend_lineno).

Not sure if this line matters for anything in php-src, but the
issue was observed in https://github.com/nikic/php-ast/issues/247.
2025-06-01 20:35:35 +02:00
Niels Dossche
2ebd1258b8
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix ext/enchant test SKIPIFs
2025-06-01 18:21:34 +02:00
Niels Dossche
9187caeab1
Fix ext/enchant test SKIPIFs
The resource check makes no sense, and the is_array() check doesn't
achieve anything. Drop the former, and replace the latter with a !
check.
Discovered while working on GH-18729.

Closes GH-18731.
2025-06-01 18:21:23 +02:00
Tim Düsterhus
3141ad0e40
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix test failures in engine_unsafe_empty_string.phpt (#18727)
2025-06-01 15:45:57 +02:00
Niels Dossche
d8a17ca7c2
Fix test failures in engine_unsafe_empty_string.phpt (#18727)
`/./` matches all characters but newlines, so if `random_bytes`
generates a string with newlines in it, the resulting string is not
empty. Fix this by adding the `s` modifier.
2025-06-01 15:45:36 +02:00
Niels Dossche
cb0b2a27e3
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak in lookup_loc_range()
2025-06-01 11:38:51 +02:00
Niels Dossche
d39d261b7e
Fix memory leak in lookup_loc_range()
Closes GH-18723.
2025-06-01 11:38:24 +02:00
Máté Kocsis
08b616e2f5
Backport relevant changes of https://github.com/php/php-src/pull/18719
These property writes may now throw exceptions because of property hooks, and this was not handled previously.
2025-05-31 22:31:48 +02:00
Gina Peter Banyard
f47a7e8056
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  tests: Fix expectations
2025-05-31 14:46:13 +01:00
Gina Peter Banyard
7f2299c8eb
tests: Fix expectations
Closes GH-18712
2025-05-31 14:45:41 +01:00
Niels Dossche
b83a8d5768
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix reference type confusion and leak in user random engine
2025-05-31 15:38:06 +02:00
Niels Dossche
75cea65c99
Fix reference type confusion and leak in user random engine
Closes GH-18718.

Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
2025-05-31 15:36:33 +02:00