com php-src: Fix #79797: Use of freed hash key in the phar_parse_zipfile function: ext/phar/tests/bug79 797.phar ext/phar/tests/bug79797.phpt e
xt/phar/zip.c

From: Date: Mon, 03 Aug 2020 08:09:44 +0000
Subject: com php-src: Fix #79797: Use of freed hash key in the phar_parse_zipfile function: ext/phar/tests/bug79 797.phar ext/phar/tests/bug79797.phpt e
xt/phar/zip.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-112497@lists.php.net to get a copy of this message
Commit: 9c3171f019d07b4271c5929478dddba0861e92af Author: Christoph M. Becker <cmbecker69@gmx.de> Tue, 14 Jul 2020 17:04:24 +0200 Committer: Stanislav Malyshev <stas@php.net> Mon, 3 Aug 2020 01:09:44 -0700 Parents: d4b32e82c81073613eae4c363f9953d5fc355023 Branches: PHP-7..4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9c3171f019d07b4271c5929478dddba0861e92af Log: Fix #79797: Use of freed hash key in the phar_parse_zipfile function We must not use heap memory after we freed it. Bugs: https://bugs.php.net/79797 Changed paths: A ext/phar/tests/bug79797.phar A ext/phar/tests/bug79797..phpt M ext/phar/zip.c Diff: diff --git a/ext/phar/tests/bug79797.phar b/ext/phar/tests/bug79797.phar new file mode 100644 index 0000000000..21d43d9eeb 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 0000000000..761e5379e0 --- /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-- +<?php +if (!extension_loaded('phar')) die('skip phar extension not available'); +?> +--INI-- +phar.cache_list={PWD}/bug79797.phar +--FILE-- +<?php +echo "done\n"; +?> +--EXPECT-- +done diff --git a/ext/phar/zip.c b/ext/phar/zip.c index e086354b11..b241c0589b 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;

« previous php.cvs (#112497) next »