1--TEST-- 2Phar: tar with huge filenames, buffer overflow 3--EXTENSIONS-- 4phar 5--INI-- 6phar.require_hash=0 7--FILE-- 8<?php 9$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.tar'; 10$pname = 'phar://' . $fname; 11 12include __DIR__ . '/files/make.dangerous.tar.php.inc'; 13 14$tar = new danger_tarmaker($fname, 'none'); 15$tar->init(); 16$tar->addFile(str_repeat('a', 101), 'hi'); 17$tar->addFile(str_repeat('a', 255), 'hi2'); 18$tar->close(); 19 20$p1 = new PharData($fname); 21foreach ($p1 as $file) { 22 echo $file->getFileName(), "\n"; 23} 24echo $p1['a/' . str_repeat('a', 100)]->getContent() . "\n"; 25echo $p1[str_repeat('a', 155) . '/' . str_repeat('a', 100)]->getContent() . "\n"; 26 27?> 28--CLEAN-- 29<?php 30unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.tar'); 31?> 32--EXPECT-- 33a 34aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 35hi 36hi2 37