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 in phar tar temporary file error handling code
This commit is contained in:
Niels Dossche
2025-09-07 13:05:13 +02:00

View File

@@ -1170,6 +1170,7 @@ nostub:
} }
zend_hash_apply_with_argument(&phar->manifest, phar_tar_writeheaders, (void *) &pass); zend_hash_apply_with_argument(&phar->manifest, phar_tar_writeheaders, (void *) &pass);
/* TODO: memory leak and incorrect continuation if phar_tar_writeheaders fails? */
/* add signature for executable tars or tars explicitly set with setSignatureAlgorithm */ /* add signature for executable tars or tars explicitly set with setSignatureAlgorithm */
if (!phar->is_data || phar->sig_flags) { if (!phar->is_data || phar->sig_flags) {
@@ -1191,6 +1192,12 @@ nostub:
entry.fp = php_stream_fopen_tmpfile(); entry.fp = php_stream_fopen_tmpfile();
if (entry.fp == NULL) { if (entry.fp == NULL) {
spprintf(error, 0, "phar error: unable to create temporary file"); spprintf(error, 0, "phar error: unable to create temporary file");
efree(signature);
if (must_close_old_file) {
php_stream_close(oldfile);
}
php_stream_close(newfile);
return; return;
} }
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN