diff options
author | Stanislav Malyshev <stas@php.net> | 2019-03-03 22:33:38 -0800 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2019-03-03 23:05:32 -0800 |
commit | e0f5d62bd6690169998474b62f92a8c5ddf0e699 (patch) | |
tree | 2ea784d2b33d1da58afe92b6f7a054f4cbfe46de /ext/phar/tests | |
parent | 759e841b247691ca3e18fd08313db26a12a41007 (diff) | |
download | php-git-e0f5d62bd6690169998474b62f92a8c5ddf0e699.tar.gz |
Fix bug #77586 - phar_tar_writeheaders_int() buffer overflow
Diffstat (limited to 'ext/phar/tests')
3 files changed, 25 insertions, 2 deletions
diff --git a/ext/phar/tests/bug71488.phpt b/ext/phar/tests/bug71488.phpt index 53f1304343..9c58d89488 100644 --- a/ext/phar/tests/bug71488.phpt +++ b/ext/phar/tests/bug71488.phpt @@ -13,5 +13,6 @@ DONE <?php @unlink(__DIR__."/bug71488.test"); ?> ---EXPECT-- -DONE +--EXPECTF-- +Fatal error: Uncaught BadMethodCallException: tar-based phar "%s/bug71488.test" cannot be created, link "%s" is too long for format in %sbug71488.php:%d +Stack trace:%A
\ No newline at end of file diff --git a/ext/phar/tests/bug77586.phpt b/ext/phar/tests/bug77586.phpt new file mode 100644 index 0000000000..039cc16994 --- /dev/null +++ b/ext/phar/tests/bug77586.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #77586 Symbolic link names in tar-formatted phar must be less than 100 bytes. +--SKIPIF-- +<?php if (!extension_loaded("phar") || true /* blocked by bug 65332 */) die("skip"); ?> +--FILE-- +<?php +$dir = __DIR__."/bug77586"; +$phar = new PharData($dir . "/bug77586.tar"); +$phar->buildFromDirectory($dir . "/files"); +?> +--CLEAN-- +<?php +$dir = __DIR__."/bug77586"; +unlink($dir . "/bug77586.tar"); +?> +--EXPECTF-- +Fatal error: Uncaught PharException: tar-based phar "%s/bug77586.tar" cannot be created, link "%s" is too long for format %s +Stack trace: +#0 %s/bug77586.php(%d): PharData->buildFromDirectory('%s') +#1 {main} + thrown in %s/bug77586.php %s on line %d diff --git a/ext/phar/tests/bug77586/files/link-nktarAMLdJBv7BGYnpzg-ZDycSpWN3Ne3kacltOSE-EqfhStJ1EoBpGuoua6VE-dne29hvpNWXiVbepwIf8-NRHWM9LITLo3nXZnKVNC b/ext/phar/tests/bug77586/files/link-nktarAMLdJBv7BGYnpzg-ZDycSpWN3Ne3kacltOSE-EqfhStJ1EoBpGuoua6VE-dne29hvpNWXiVbepwIf8-NRHWM9LITLo3nXZnKVNC new file mode 100644 index 0000000000..1de565933b --- /dev/null +++ b/ext/phar/tests/bug77586/files/link-nktarAMLdJBv7BGYnpzg-ZDycSpWN3Ne3kacltOSE-EqfhStJ1EoBpGuoua6VE-dne29hvpNWXiVbepwIf8-NRHWM9LITLo3nXZnKVNC @@ -0,0 +1 @@ +target
\ No newline at end of file |