forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MFH: fix faulty fix for Bug #40189, and provide real fix for the bug
- Loading branch information
Greg Beaver
committed
Jan 12, 2008
1 parent
7c1952c
commit 79abe24
Showing
5 changed files
with
51 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--TEST-- | ||
Bug #40189 (endless loop in zlib.inflate stream filter) | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("zlib")) print "skip"; ?> | ||
--FILE-- | ||
<?php | ||
// this string is an excerpt of a phar archive that caused an infinite loop | ||
$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"; | ||
var_dump(base64_encode($a)); | ||
$gp = fopen('test.other', 'wb'); | ||
$fp = fopen('data://text/plain;base64,AwCFRi98wqppK23l2/7kIY8AlyEdAgAAAEdCTUI=', 'r'); | ||
stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ); | ||
var_dump(stream_copy_to_stream($fp, $gp, 5)); | ||
fclose($fp); | ||
fclose($gp); | ||
var_dump(file_get_contents('test.other')); | ||
?> | ||
--EXPECT-- | ||
string(40) "AwCFRi98wqppK23l2/7kIY8AlyEdAgAAAEdCTUI=" | ||
int(0) | ||
string(0) "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--TEST-- | ||
Bug #40189 (test for truncated deflate, also part of erroneous fix for #40189) | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("zlib")) print "skip"; ?> | ||
--FILE-- | ||
<?php | ||
$a = fopen('ext/zlib/tests/bug.tar', 'rb'); | ||
stream_filter_append($a, 'zlib.deflate', STREAM_FILTER_READ, array('window' => 15+16)); | ||
$b = fread($a, 4716032); | ||
var_dump(strlen($b)); | ||
// when broken, this outputs "int(686904)" | ||
?> | ||
--EXPECT-- | ||
int(1676116) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters