mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
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
This commit is contained in:
4
NEWS
4
NEWS
@@ -26,6 +26,10 @@ PHP NEWS
|
||||
. Fix memory leak in intl_datetime_decompose() on failure. (nielsdos)
|
||||
. Fix memory leak in locale lookup on failure. (nielsdos)
|
||||
|
||||
- OpenSSL:
|
||||
. Fix memory leak of X509_STORE in php_openssl_setup_verify() on failure.
|
||||
(nielsdos)
|
||||
|
||||
- Phar:
|
||||
. Add missing filter cleanups on phar failure. (nielsdos)
|
||||
. Fixed bug GH-18642 (Signed integer overflow in ext/phar fseek). (nielsdos)
|
||||
|
||||
@@ -2443,6 +2443,7 @@ static X509_STORE *php_openssl_setup_verify(zval *calist, uint32_t arg_num)
|
||||
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(calist), item) {
|
||||
zend_string *str = zval_try_get_string(item);
|
||||
if (UNEXPECTED(!str)) {
|
||||
X509_STORE_free(store);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
22
ext/openssl/tests/memory_leak_x509_store.phpt
Normal file
22
ext/openssl/tests/memory_leak_x509_store.phpt
Normal file
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Memory leak of X509_STORE in php_openssl_setup_verify() on failure
|
||||
--EXTENSIONS--
|
||||
openssl
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class MyStringable{
|
||||
public function __toString(): string {
|
||||
throw new Error('stop');
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
openssl_pkcs7_verify("does not matter", 0, "does not matter", [new MyStringable]);
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
stop
|
||||
Reference in New Issue
Block a user