1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.4'

* PHP-8.4:
  Fix memory leak of X509_STORE in php_openssl_setup_verify() on failure
This commit is contained in:
Niels Dossche
2025-06-03 23:50:30 +02:00
2 changed files with 23 additions and 0 deletions

View File

@@ -894,6 +894,7 @@ 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;
}

View 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