diff --git a/ext/phar/tests/bug79797.phar b/ext/phar/tests/bug79797.phar new file mode 100644 index 00000000000..21d43d9eeb6 Binary files /dev/null and b/ext/phar/tests/bug79797.phar differ diff --git a/ext/phar/tests/bug79797.phpt b/ext/phar/tests/bug79797.phpt new file mode 100644 index 00000000000..761e5379e00 --- /dev/null +++ b/ext/phar/tests/bug79797.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #79797 (Use of freed hash key in the phar_parse_zipfile function) +--SKIPIF-- + +--INI-- +phar.cache_list={PWD}/bug79797.phar +--FILE-- + +--EXPECT-- +done diff --git a/ext/phar/zip.c b/ext/phar/zip.c index e086354b115..b241c0589b4 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -712,7 +712,7 @@ foundit: efree(actual_alias); } - zend_hash_str_add_ptr(&(PHAR_G(phar_alias_map)), actual_alias, mydata->alias_len, mydata); + zend_hash_str_add_ptr(&(PHAR_G(phar_alias_map)), mydata->alias, mydata->alias_len, mydata); } else { phar_archive_data *fd_ptr;