com php-src: Fix bug #73035 (Out of bound when verify signature of tar phar in phar_parse_tarfile): ext/phar/tar.c ext/phar/t ests/bug73035.phpt
ext/phar/tests/bug7303 5.tar

From: Date: Tue, 13 Sep 2016 04:04:23 +0000
Subject: com php-src: Fix bug #73035 (Out of bound when verify signature of tar phar in phar_parse_tarfile): ext/phar/tar.c ext/phar/t ests/bug73035.phpt
ext/phar/tests/bug7303 5.tar
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-94441@lists.php.net to get a copy of this message
Commit: f5a9592ad8d2b60cabbaff00662477528ecefb48 Author: Stanislav Malyshev <stas@php.net> Sun, 11 Sep 2016 21:37:44 -0700 Parents: 6a7cc8ff85827fa9ac715b3a83c2d9147f33cd43 Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f5a9592ad8d2b60cabbaff00662477528ecefb48 Log: Fix bug #73035 (Out of bound when verify signature of tar phar in phar_parse_tarfile) Bugs: https://bugs..php.net/73035 Changed paths: M ext/phar/tar.c A ext/phar/tests/bug73035.phpt A ext/phar/tests/bug73035.tar Diff: diff --git a/ext/phar/tar.c b/ext/phar/tar.c index 62edcb5..898ff85 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -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); } diff --git a/ext/phar/tests/bug73035.phpt b/ext/phar/tests/bug73035.phpt new file mode 100644 index 0000000..5928428 --- /dev/null +++ b/ext/phar/tests/bug73035.phpt @@ -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 \ No newline at end of file diff --git a/ext/phar/tests/bug73035.tar b/ext/phar/tests/bug73035.tar new file mode 100644 index 0000000..d8e4268 Binary files /dev/null and b/ext/phar/tests/bug73035.tar differ

« previous php.cvs (#94441) next »