Skip to content

Commit 07fe3b2

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix potential NULL pointer dereference before calling EVP_SignInit
2 parents f52b2a9 + 6f8bda0 commit 07fe3b2

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ PHP NEWS
3030
filename causes a NULL pointer dereference). (nielsdos)
3131
. Fixed bug GH-13833 (Applying zero offset to null pointer in zend_hash.c).
3232
(nielsdos)
33+
. Fix potential NULL pointer dereference before calling EVP_SignInit. (icy17)
3334

3435
- PHPDBG:
3536
. Fixed bug GH-13827 (Null pointer access of type 'zval' in phpdbg_frame).

ext/phar/util.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,6 +1890,13 @@ int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signat
18901890
}
18911891

18921892
md_ctx = EVP_MD_CTX_create();
1893+
if (md_ctx == NULL) {
1894+
EVP_PKEY_free(key);
1895+
if (error) {
1896+
spprintf(error, 0, "unable to initialize openssl signature for phar \"%s\"", phar->fname);
1897+
}
1898+
return FAILURE;
1899+
}
18931900

18941901
siglen = EVP_PKEY_size(key);
18951902
sigbuf = emalloc(siglen + 1);

0 commit comments

Comments
 (0)