[php-src] master: Properly propagate X509_STORE_CTX_new() (#22625)
Nora Dossche via GitHub <[email protected]> Mon, 3 Aug 2026 20:51:57 +0000
| Newsgroups | gmane.comp.php.cvs.general |
|---|---|
| Message-ID | <[email protected]> |
Author: Nora Dossche (ndossche)
Committer: GitHub (web-flow)
Pusher: ndossche
Date: 2026-08-03T22:51:54+02:00
Commit: https://github.com/php/php-src/commit/decc1568a14c7097a48965208eed2c6cc542051e
Raw diff: https://github.com/php/php-src/commit/decc1568a14c7097a48965208eed2c6cc542051e.diff
Properly propagate X509_STORE_CTX_new() (#22625)
Propagating is consistent with other "new" failures, and avoids bailing out,
which is inherently problematic anyway as it can cause persistent leaks
on its own.
Changed paths:
M ext/openssl/openssl_backend_common.c
Diff:
diff --git a/ext/openssl/openssl_backend_common.c b/ext/openssl/openssl_backend_common.c
index 7261a617af32..8adf1ac813f1 100644
--- a/ext/openssl/openssl_backend_common.c
+++ b/ext/openssl/openssl_backend_common.c
@@ -750,7 +750,7 @@ int php_openssl_check_cert(X509_STORE *ctx, X509 *x, STACK_OF(X509) *untrustedch
csc = X509_STORE_CTX_new();
if (csc == NULL) {
php_openssl_store_errors();
- php_error_docref(NULL, E_ERROR, "Memory allocation failure");
+ php_error_docref(NULL, E_WARNING, "Memory allocation failure");
return 0;
}
if (!X509_STORE_CTX_init(csc, ctx, x, untrustedchain)) {