mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix bug #73035 (Out of bound when verify signature of tar phar in phar_parse_tarfile)
This commit is contained in:
parent
6a7cc8ff85
commit
f5a9592ad8
3 changed files with 19 additions and 1 deletions
|
@ -286,7 +286,7 @@ bail:
|
|||
}
|
||||
curloc = php_stream_tell(fp);
|
||||
read = php_stream_read(fp, buf, size);
|
||||
if (read != size) {
|
||||
if (read != size || read <= 8) {
|
||||
if (error) {
|
||||
spprintf(error, 4096, "phar error: tar-based phar \"%s\" signature cannot be read", fname);
|
||||
}
|
||||
|
|
18
ext/phar/tests/bug73035.phpt
Normal file
18
ext/phar/tests/bug73035.phpt
Normal file
|
@ -0,0 +1,18 @@
|
|||
--TEST--
|
||||
Phar: #73035 (Out of bound when verify signature of tar phar in phar_parse_tarfile)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("phar")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
chdir(__DIR__);
|
||||
try {
|
||||
$phar = new PharData('bug73035.tar');
|
||||
var_dump($phar);
|
||||
} catch(UnexpectedValueException $e) {
|
||||
print $e->getMessage()."\n";
|
||||
}
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
phar error: tar-based phar "%sbug73035.tar" signature cannot be read
|
||||
DONE
|
BIN
ext/phar/tests/bug73035.tar
Normal file
BIN
ext/phar/tests/bug73035.tar
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue