Annotation of embedaddon/php/ext/zlib/tests/bug_40189.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #40189 (endless loop in zlib.inflate stream filter)
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("zlib")) print "skip"; ?>
! 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(dirname(__FILE__) . '/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(dirname(__FILE__) . '/test.other'));
! 19: ?>
! 20: --CLEAN--
! 21: <?php
! 22: @unlink(dirname(__FILE__) . '/test.other');
! 23: ?>
! 24: --EXPECT--
! 25: string(40) "AwCFRi98wqppK23l2/7kIY8AlyEdAgAAAEdCTUI="
! 26: int(0)
! 27: string(0) ""
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>