bug_40189.phpt 810 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. Bug #40189 (endless loop in zlib.inflate stream filter)
  3. --EXTENSIONS--
  4. zlib
  5. --INI--
  6. allow_url_fopen=1
  7. --FILE--
  8. <?php
  9. // this string is an excerpt of a phar archive that caused an infinite loop
  10. $a = "\x3\x0\x85\x46\x2f\x7c\xc2\xaa\x69\x2b\x6d\xe5\xdb\xfe\xe4\x21\x8f\x0\x97\x21\x1d\x2\x0\x0\x0\x47\x42\x4d\x42";
  11. var_dump(base64_encode($a));
  12. $gp = fopen(__DIR__ . '/test.other', 'wb');
  13. $fp = fopen('data://text/plain;base64,AwCFRi98wqppK23l2/7kIY8AlyEdAgAAAEdCTUI=', 'r');
  14. stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ);
  15. var_dump(stream_copy_to_stream($fp, $gp, 5));
  16. fclose($fp);
  17. fclose($gp);
  18. var_dump(file_get_contents(__DIR__ . '/test.other'));
  19. ?>
  20. --CLEAN--
  21. <?php
  22. @unlink(__DIR__ . '/test.other');
  23. ?>
  24. --EXPECT--
  25. string(40) "AwCFRi98wqppK23l2/7kIY8AlyEdAgAAAEdCTUI="
  26. int(0)
  27. string(0) ""