mirror of
https://github.com/php/php-src.git
synced 2025-08-21 01:45:16 +02:00
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix #79877: getimagesize function silently truncates after a null byte Fix #79797: Use of freed hash key in the phar_parse_zipfile function
This commit is contained in:
commit
5b29af5c78
5 changed files with 29 additions and 1 deletions
BIN
ext/phar/tests/bug79797.phar
Normal file
BIN
ext/phar/tests/bug79797.phar
Normal file
Binary file not shown.
14
ext/phar/tests/bug79797.phpt
Normal file
14
ext/phar/tests/bug79797.phpt
Normal 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
|
|
@ -705,7 +705,7 @@ foundit:
|
||||||
efree(actual_alias);
|
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 {
|
} else {
|
||||||
phar_archive_data *fd_ptr;
|
phar_archive_data *fd_ptr;
|
||||||
|
|
||||||
|
|
|
@ -1496,6 +1496,11 @@ static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode) {
|
||||||
Z_PARAM_ZVAL_DEREF(info)
|
Z_PARAM_ZVAL_DEREF(info)
|
||||||
ZEND_PARSE_PARAMETERS_END();
|
ZEND_PARSE_PARAMETERS_END();
|
||||||
|
|
||||||
|
if (mode == FROM_PATH && CHECK_NULL_PATH(input, input_len)) {
|
||||||
|
php_error_docref(NULL, E_WARNING, "Invalid path");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (argc == 2) {
|
if (argc == 2) {
|
||||||
zval_ptr_dtor(info);
|
zval_ptr_dtor(info);
|
||||||
array_init(info);
|
array_init(info);
|
||||||
|
|
9
ext/standard/tests/image/bug79877.phpt
Normal file
9
ext/standard/tests/image/bug79877.phpt
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #79877 (getimagesize function silently truncates after a null byte)
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
var_dump(getimagesize("/tmp/a.png\0xx"));
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
Warning: getimagesize(): Invalid path in %s on line %d
|
||||||
|
NULL
|
Loading…
Add table
Add a link
Reference in a new issue