Commit graph

139930 commits

Author SHA1 Message Date
Jakub Zelenka
0d19984cda
Merge branch 'PHP-8.3' into PHP-8.4 2025-07-15 11:24:34 +02:00
Jakub Zelenka
6b2b60f683
Fix bug #80770: openssl cafile not used in SNI SSL_CTX
The issue is about not being able to connect as cafile for SNI
is not used in its SSL context. This sets it up so it is possible
to capture the client certificate which is only possible when
verify_peer is true.

Closes GH-18893
2025-07-15 11:23:10 +02:00
Dmitry Stogov
9abb0fb0c4
Revert "Update IR"
This reverts commit e8ae27bf8a.

Something wrong in irrducable loops habdling that causes ir_find_loop()
to stuck. See https://github.com/php/php-src/issues/19104
2025-07-14 14:27:05 +03:00
Niels Dossche
76b6b60b8c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19094: Attaching class with no Iterator implementation to MultipleIterator causes crash
2025-07-11 12:28:25 +02:00
Niels Dossche
71472268c0
Fix GH-19094: Attaching class with no Iterator implementation to MultipleIterator causes crash
Closes GH-19097.
2025-07-11 12:27:41 +02:00
Niels Dossche
de7a212630
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/soap/php_http.c: Fix memory leak of header value
2025-07-10 22:32:52 +02:00
Gina Peter Banyard
85a49d4198
ext/soap/php_http.c: Fix memory leak of header value 2025-07-10 22:32:31 +02:00
Niels Dossche
5a45d71a11
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/gd: Drop useless and doubtful MSVC specific code (libgd/libgd@f1480ab)
2025-07-10 22:22:26 +02:00
Demon
974526b244
ext/gd: Drop useless and doubtful MSVC specific code (libgd/libgd@f1480ab) 2025-07-10 22:22:01 +02:00
Niels Dossche
2fa0e55450
Update NEWS for GH-19068 2025-07-10 22:14:38 +02:00
Demon
12fa8c637f
ext/gd: Drop useless and doubtful MSVC specific code (libgd/libgd@f1480ab) 2025-07-10 22:13:29 +02:00
Demon
2be3aa86f0
Zend: fix undefined symbol 'execute_ex' on Windows ARM64 #19064; ext/gd: fix emmintrin.h not found on Windows ARM64 2025-07-10 22:13:29 +02:00
Ilija Tovilo
74784a0d52
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Add missing zlib dep to phar compression test
2025-07-07 16:28:49 +02:00
Ilija Tovilo
faa78313d9
[skip ci] Add missing zlib dep to phar compression test 2025-07-07 16:28:18 +02:00
Dmitry Stogov
e8ae27bf8a
Update IR
IR commit: af6dc83bcd91c3123f40efcdcbeba8794b9b2abf
2025-07-07 14:03:11 +03:00
Peter Kokot
ab6e73066b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix -Wuseless-escape warnings emitted by re2c (#19050)
2025-07-07 09:51:50 +02:00
Peter Kokot
258fbd6bf9
Fix -Wuseless-escape warnings emitted by re2c (#19050)
re2c version 4 enabled some warnings by default. This fixes re2c code
for the `-Wuseless-escape` warnings.

There are two same issues reported.
Issue: GH-17523
Closes: GH-17204
2025-07-07 09:51:25 +02:00
Niels Dossche
2aeefb13be
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix phar crash and file corruption with SplFileObject
2025-07-05 21:44:34 +02:00
Niels Dossche
405be1c940
Fix phar crash and file corruption with SplFileObject
There are two bugfixes here.
The first was a crash that I discovered while working on GH-19035.
The check for when a file pointer was still occupied was wrong, leading
to a UAF. Strangely, zip got this right.

The second issue was that even after fixing the first one, the file
contents were garbage. This is because the file write offset for the
phar stream was wrong.

Closes GH-19038.
2025-07-05 21:44:12 +02:00
Niels Dossche
50a5a6f315
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix stream double free in phar
2025-07-05 21:31:50 +02:00
Niels Dossche
32344c4dc4
Fix stream double free in phar
The copy function does two things wrong:
- The error recovery logic is a hack that temporarily moves the fp
  pointer to cfp, even though it's not compressed. The respective error
  recovery it talks about is not present in the code, nor is it
  necessary. This is the direct cause of the double free in the original
  reproducer. Fixing this makes it crash in another location though.
- The link following logic is inconsistent and illogical. It cannot be a
  link at this point.

The root cause, after fixing the above issues, is that the file pointers
are not reset properly for the copy. The file pointer need to be the
original ones to perform the copy from the right source, but after that
they need to be set properly to NULL (because fp_type == PHAR_FP).

Closes GH-19035.

Co-authored-by: Yun Dou <dixyes@gmail.com>
2025-07-05 21:31:28 +02:00
Niels Dossche
1af7d8e547
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix OSS-Fuzz #428983568 and #428760800
2025-07-04 23:58:33 +02:00
Niels Dossche
4aac98f145
Fix OSS-Fuzz #428983568 and #428760800
Both these issues have the same root cause, their reproducer is
extremely similar so I don't duplicate the test.

If the parser invokes the lexer, and the lexer fails, it could've
allocated a string which must be freed when the parser backs up.
The `%destructor` list is responsible for this but did not have an entry
for `fallback` yet. Solve the issue by adding such an entry.

Closes GH-19012.
2025-07-04 23:58:06 +02:00
Ben Ramsey
2cb292de6b
Merge branch 'PHP-8.3' into PHP-8.4 2025-07-03 10:35:50 -05:00
Ben Ramsey
304d223a2f
Merge branch 'PHP-8.2' into PHP-8.3 2025-07-03 10:35:31 -05:00
Ben Ramsey
58977be208
Merge branch 'PHP-8.1' into PHP-8.2 2025-07-03 10:35:05 -05:00
Ilija Tovilo
b6660634b4
Disable JIT on Apple Silicon + ZTS
Apple Silicon has stricter rules about rwx mmap regions. They need to be created
using the MAP_JIT flag. However, the MAP_JIT seems to be incompatible with
MAP_SHARED. ZTS requires MAP_SHARED so that some threads may execute code from a
page while another writes/appends to it. We did not find another solution, other
than completely disabling JIT for Apple Silicon + ZTS.

See discussion in https://github.com/php/php-src/pull/13351.

Co-authored-by: Peter Kokot <peterkokot@gmail.com>
Fixes GH-13400
Closes GH-13396
2025-07-03 10:34:04 -05:00
Saki Takamachi
f512cffcd0
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18873 - Free column->descid appropriately (#18957)
2025-07-03 21:24:56 +09:00
SakiTakamachi
c161bb0c18
Fix GH-18873 - Free column->descid appropriately (#18957)
fixes #18873
closes #18957
2025-07-03 21:09:44 +09:00
Niels Dossche
764154dc75
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18990, bug #81029, bug #47314: SOAP HTTP socket not closing on object destruction
  Fix leak when path is too long in ZipArchive::extractTo()
  curl: Remove incorrect string release on error
2025-07-02 18:46:37 +02:00
Niels Dossche
69328ba304
Fix GH-18990, bug #81029, bug #47314: SOAP HTTP socket not closing on object destruction
Currently the resource is attached to the object and its refcount is
increased. This means that the refcount to the resource is 2 instead of
1 as expected. A refcount of 2 is necessary in the current code because
of how the error handling works: by using convert_to_null() the resource
actually goes to rc_dtor_func(), dropping its refcount to 1. So on error
the refcount is correct.
To solve the issue, let `stream` conceptually be a borrow of the
resource with refcount 1, and just use ZVAL_NULL() to prevent calling
rc_dtor_func() on the resource.

Closes GH-19001.
2025-07-02 18:44:05 +02:00
Niels Dossche
09c223de00
Fix leak when path is too long in ZipArchive::extractTo()
I did not find an easy way to trigger this branch without also
triggering some other error conditions earlier.

Closes GH-19002.
2025-07-02 18:43:25 +02:00
Niels Dossche
11ea995ff3
curl: Remove incorrect string release on error
The string is owned by the caller, and the caller releases it.

Closes GH-18989.
2025-07-02 18:42:50 +02:00
Saki Takamachi
d5fe1bce63
PHP-8.4 is now for PHP 8.4.11-dev 2025-07-02 11:39:33 +09:00
Ben Ramsey
881ec133d9
Merge branch 'PHP-8.3' into PHP-8.4 2025-07-01 15:21:57 -05:00
Ben Ramsey
fa960f7d95
Merge branch 'PHP-8.2' into PHP-8.3 2025-07-01 15:21:38 -05:00
Ben Ramsey
442638e562
Merge branch 'PHP-8.1' into PHP-8.2 2025-07-01 15:21:23 -05:00
Ben Ramsey
ca09f4dba4
PHP-8.1 is now for PHP 8.1.34-dev 2025-07-01 15:17:40 -05:00
Ben Ramsey
13bc0e2367
Merge branch 'PHP-8.1.33-security' into PHP-8.1 2025-07-01 15:13:25 -05:00
Sergey Panteleev
7a3c0d3519
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  PHP-8.2 is now for PHP 8.2.30-dev
  Update NEWS with entries for security fixes
  Fix GHSA-453j-q27h-5p8x
  Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
  Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
2025-07-01 19:58:36 +03:00
Sergey Panteleev
b576ad4ca3
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  PHP-8.2 is now for PHP 8.2.30-dev
  Update NEWS with entries for security fixes
  Fix GHSA-453j-q27h-5p8x
  Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
  Fix GHSA-3cr5-j632-f35r: Null byte in hostnames

# Conflicts:
#	Zend/zend.h
#	configure.ac
#	ext/pgsql/pgsql.c
#	main/php_version.h
2025-07-01 19:58:02 +03:00
Niels Dossche
5d590a1e87
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix OSS-Fuzz #427814456
2025-07-01 18:52:39 +02:00
Niels Dossche
1d5089e574
Fix GH-18979: DOM\XMLDocument::createComment() triggers undefined behavior with null byte
Closes GH-18983.
2025-07-01 18:51:21 +02:00
Niels Dossche
91749844e6
Fix OSS-Fuzz #427814456
The first warning may trigger an error handler, destroying the operand
and its string. So we need to protect the string in that case.
Care was taken to avoid unnecessary refcounts and to avoid touching the
hot code path.

Closes GH-18951.
2025-07-01 18:50:41 +02:00
Sergey Panteleev
3d8cc222d5
PHP-8.2 is now for PHP 8.2.30-dev 2025-07-01 19:49:50 +03:00
Jakub Zelenka
165e5169a9
Update NEWS with entries for security fixes 2025-07-01 19:46:54 +03:00
Ahmed Lekssays
0298837252
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-01 19:46:51 +03:00
Jakub Zelenka
a2cdff5583
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-01 19:46:48 +03:00
Jakub Zelenka
27e67cc371
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-01 19:46:42 +03:00
Eric Mann
7f5d491a05
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Update NEWS with entries for security fixes
  Fix GHSA-453j-q27h-5p8x
  Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
  Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
2025-07-01 09:39:53 -07:00