php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #54946 stream_get_contents infinite loop
Submitted: 2011-05-28 13:13 UTC Modified: 2011-05-29 14:29 UTC
From: max at cxib dot net Assigned: bjori
Status: Closed Package: Streams related
PHP Version: 5.3.6 OS: NetBSD
Private report: No CVE-ID:
 [2011-05-28 13:13 UTC] max at cxib dot net
Description:
------------
#0  0xbb80eb77 in read () from /usr/lib/libc.so.12
#1  0xbb8e0efd in read () from /usr/lib/libpthread.so.0
#2  0x083e7e81 in _php_stream_fopen_from_pipe ()
#3  0x083dff2f in _php_stream_free ()
#4  0x083e00ec in _php_stream_read ()
#5  0x083e1684 in _php_stream_copy_to_mem ()


php_stream_copy_to_mem() generate infinite loop


Test script:
---------------
<?php
$stream=fopen("/tmp/blabla", "w"); // w or a
stream_get_contents($stream,1,1);
?>

Expected result:
----------------
string or null

Actual result:
--------------
infinite loop

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-29 14:29 UTC] bjori@php.net
Automatic comment from SVN on behalf of bjori
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=311545
Log: Fixed bug #54946 (stream_get_contents infinite loop)
 [2011-05-29 14:29 UTC] bjori@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: bjori
 [2011-05-29 14:29 UTC] bjori@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2012-04-18 09:50 UTC] laruence@php.net
Automatic comment on behalf of bjori
Revision: http://git.php.net/?p=php-src.git;a=commit;h=73c1488fec205da2d9a7db7c07e652342ffaeab1
Log: Fixed bug #54946 (stream_get_contents infinite loop)
 [2012-07-24 23:41 UTC] rasmus@php.net
Automatic comment on behalf of bjori
Revision: http://git.php.net/?p=php-src.git;a=commit;h=73c1488fec205da2d9a7db7c07e652342ffaeab1
Log: Fixed bug #54946 (stream_get_contents infinite loop)
 [2013-11-17 09:38 UTC] laruence@php.net
Automatic comment on behalf of bjori
Revision: http://git.php.net/?p=php-src.git;a=commit;h=73c1488fec205da2d9a7db7c07e652342ffaeab1
Log: Fixed bug #54946 (stream_get_contents infinite loop)
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sun Apr 20 15:01:54 2014 UTC