bug73809.phpt 706 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. Bug #73809 (Phar Zip parse crash - mmap fail)
  3. --EXTENSIONS--
  4. phar
  5. zip
  6. --FILE--
  7. <?php
  8. // create the ZIP to be tested
  9. $zip = new ZipArchive;
  10. $zip->open(__DIR__ . '/73809.zip', ZipArchive::CREATE);
  11. $zip->addFromString('73809.txt', 'yada yada');
  12. $zip->addFromString('.phar/signature.bin', str_repeat('*', 64 * 1024 + 1));
  13. $zip->setCompressionName('.phar/signature.bin', ZipArchive::CM_STORE);
  14. var_dump($zip->close());
  15. try {
  16. $phar = new PharData(__DIR__ . '/73809.zip');
  17. } catch (Exception $ex) {
  18. echo $ex->getMessage(), PHP_EOL;
  19. }
  20. ?>
  21. --CLEAN--
  22. <?php
  23. @unlink(__DIR__ . '/73809.zip');
  24. ?>
  25. --EXPECTF--
  26. bool(true)
  27. phar error: signatures larger than 64 KiB are not supported in zip-based phar "%s"