Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/openssl/openssl_backend_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ STACK_OF(X509) *php_openssl_load_all_certs_from_file(
}

/* This loads from a file, a stack of x509/crl/pkey sets */
if (!(sk = PEM_X509_INFO_read_bio(in, NULL, NULL, NULL))) {
if (!(sk = php_openssl_pem_read_bio_x509_info(in))) {
php_openssl_store_errors();
php_error_docref(NULL, E_WARNING, "Error reading the file, %s", cert_path);
sk_X509_free(stack);
Expand Down
5 changes: 5 additions & 0 deletions ext/openssl/openssl_backend_v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,11 @@ X509_REQ *php_openssl_pem_read_bio_x509_req(BIO *in)
return PEM_read_bio_X509_REQ(in, NULL, NULL, NULL);
}

STACK_OF(X509_INFO) *php_openssl_pem_read_bio_x509_info(BIO *in)
{
return PEM_X509_INFO_read_bio(in, NULL, NULL, NULL);
}

EVP_PKEY *php_openssl_pem_read_bio_public_key(BIO *in)
{
return PEM_read_bio_PUBKEY(in, NULL, NULL, NULL);
Expand Down
5 changes: 5 additions & 0 deletions ext/openssl/openssl_backend_v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,11 @@ X509_REQ *php_openssl_pem_read_bio_x509_req(BIO *in)
return xr;
}

STACK_OF(X509_INFO) *php_openssl_pem_read_bio_x509_info(BIO *in)
{
return PEM_X509_INFO_read_bio_ex(in, NULL, NULL, NULL, PHP_OPENSSL_LIBCTX, PHP_OPENSSL_PROPQ);
}

EVP_PKEY *php_openssl_pem_read_bio_public_key(BIO *in)
{
return PEM_read_bio_PUBKEY_ex(in, NULL, NULL, NULL, PHP_OPENSSL_LIBCTX, PHP_OPENSSL_PROPQ);
Expand Down
1 change: 1 addition & 0 deletions ext/openssl/php_openssl_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ zend_string *php_openssl_pkey_derive(EVP_PKEY *key, EVP_PKEY *peer_key, size_t r
X509 *php_openssl_pem_read_asn1_bio_x509(BIO *in);
X509 *php_openssl_pem_read_bio_x509(BIO *in);
X509_REQ *php_openssl_pem_read_bio_x509_req(BIO *in);
STACK_OF(X509_INFO) *php_openssl_pem_read_bio_x509_info(BIO *in);
EVP_PKEY *php_openssl_pem_read_bio_public_key(BIO *in);
EVP_PKEY *php_openssl_pem_read_bio_private_key(BIO *in, pem_password_cb *cb, void *u);
PKCS7 *php_openssl_pem_read_bio_pkcs7(BIO *in);
Expand Down
6 changes: 1 addition & 5 deletions ext/phar/phar.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,13 +595,9 @@ zend_result phar_metadata_tracker_unserialize_or_copy(phar_metadata_tracker *tra
const bool has_unserialize_options = unserialize_options != NULL && zend_hash_num_elements(unserialize_options) > 0;
/* It should be impossible to create a zval in a persistent phar/entry. */
ZEND_ASSERT(!persistent || Z_ISUNDEF(tracker->val));
ZEND_ASSERT(!EG(exception));

if (Z_ISUNDEF(tracker->val) || has_unserialize_options) {
if (EG(exception)) {
/* Because other parts of the phar code haven't been updated to check for exceptions after doing something that may throw,
* check for exceptions before potentially serializing/unserializing instead. */
return FAILURE;
}
/* Persistent phars should always be unserialized. */
const char *start;
/* Assert it should not be possible to create raw data in a persistent phar (i.e. from cache_list) */
Expand Down