stream_socket_append() twice will cause segfault
| Bug #35916 | stream_socket_append() twice will cause segfault | ||||
|---|---|---|---|---|---|
| Submitted: | 2006-01-06 06:59 UTC | Modified: | 2006-01-10 17:14 UTC | ||
| From: | sqchen at citiz dot net | Assigned: | pollita (profile) | ||
| Status: | Closed | Package: | Streams related | ||
| PHP Version: | 5CVS-2006-01-07 (cvs) | OS: | * | ||
| Private report: | No | CVE-ID: | None | ||
[2006-01-06 06:59 UTC] sqchen at citiz dot net
Description:
------------
stream_socket_append() twice will cause segfault, the same as stream_socket_prepend()
Reproduce code:
---------------
<?php
class strtoupper_filter extends php_user_filter{
function filter($in, $out, &$consumed, $closing)
{
while($bucket=stream_bucket_make_writeable($in)){
$bucket->data = strtoupper($bucket->data);
$consumed += $bucket->datalen;
stream_bucket_append($out, $bucket);
/*here twice will cause segfault*/
stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
}
function onCreate(){
echo "fffffffffff\n";
}
function onClose(){
echo "hello\n";
}
}
stream_filter_register("strtoupper", "strtoupper_filter");
$fp=fopen("1.txt", "w");
stream_filter_append($fp, "strtoupper");
fread($fp, 1024);
fwrite($fp, "Thank you\n");
fclose($fp);
readfile("1.txt");
unlink("1.txt");
?>
Actual result:
--------------
segfault
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2006-01-06 09:03 UTC] sqchen at citiz dot net
[2006-01-06 12:51 UTC] tony2001@php.net
[2006-01-10 17:14 UTC] iliaa@php.net