summaryrefslogtreecommitdiff
path: root/ext/phar
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2019-07-29 13:19:16 -0700
committerStanislav Malyshev <stas@php.net>2019-07-29 13:19:16 -0700
commit284fb08fdc7465db6ed550b088bc0e7d38ddac4e (patch)
tree49ac6a87f810c5b2fc16e887c18af380baad9233 /ext/phar
parentdc7aa22b18b710aaa837c9466e9a77241f909c8a (diff)
parentcd1101e8c87aa175c2d5e87ddec656e50ef4ab5d (diff)
downloadphp-git-284fb08fdc7465db6ed550b088bc0e7d38ddac4e.tar.gz
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1: Fix #77919: Potential UAF in Phar RSHUTDOWN Update NEWS Fix bug #78256 (heap-buffer-overflow on exif_process_user_comment) Fix bug #78222 (heap-buffer-overflow on exif_scan_thumbnail)
Diffstat (limited to 'ext/phar')
-rw-r--r--ext/phar/phar_object.c4
-rw-r--r--ext/phar/tests/bug71488.phpt5
2 files changed, 7 insertions, 2 deletions
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index 88619663f1..2669413fe6 100644
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -2037,7 +2037,7 @@ static zend_object *phar_rename_archive(phar_archive_data **sphar, char *ext) /*
char *newname = NULL, *newpath = NULL;
zval ret, arg1;
zend_class_entry *ce;
- char *error;
+ char *error = NULL;
const char *pcr_error;
int ext_len = ext ? strlen(ext) : 0;
size_t new_len, oldname_len, phar_ext_len;
@@ -2252,6 +2252,8 @@ its_ok:
phar_flush(phar, 0, 0, 1, &error);
if (error) {
+ zend_hash_str_del(&(PHAR_G(phar_fname_map)), newpath, phar->fname_len);
+ *sphar = NULL;
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s", error);
efree(error);
efree(oldpath);
diff --git a/ext/phar/tests/bug71488.phpt b/ext/phar/tests/bug71488.phpt
index 9c58d89488..7f8f6c00af 100644
--- a/ext/phar/tests/bug71488.phpt
+++ b/ext/phar/tests/bug71488.phpt
@@ -15,4 +15,7 @@ DONE
?>
--EXPECTF--
Fatal error: Uncaught BadMethodCallException: tar-based phar "%s/bug71488.test" cannot be created, link "%s" is too long for format in %sbug71488.php:%d
-Stack trace:%A \ No newline at end of file
+Stack trace:
+#0 %s(%d): PharData->decompress('test')
+#1 {main}
+ thrown in %s on line %d