Fix #79797: Use of freed hash key in the phar_parse_zipfile function

We must not use heap memory after we freed it.
This commit is contained in:
Christoph M. Becker 2020-07-14 17:04:24 +02:00 committed by Stanislav Malyshev
parent 24495ba778
commit 775385df0e
3 changed files with 15 additions and 1 deletions

Binary file not shown.

View file

@ -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

View file

@ -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;