iliaa Tue Jul 5 15:24:07 2005 EDT Added files: /php-src/ext/standard/tests/file stream_get_line.phpt
Modified files: /php-src NEWS /php-src/ext/standard streamsfuncs.c Log: Fixed crash inside stream_get_line() when length parameter equals 0. http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1980&r2=1.1981&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1980 php-src/NEWS:1.1981 --- php-src/NEWS:1.1980 Tue Jul 5 08:45:38 2005 +++ php-src/NEWS Tue Jul 5 15:24:06 2005 @@ -8,6 +8,7 @@ - Implemented feature request #33452 (Year belonging to ISO week). (Derick) - Fixed memory corruption in pg_copy_from() in case the as_null parameter was passed. (Derick) +- Fixed crash inside stream_get_line() when length parameter equals 0. (Ilia) - Fixed bug #33562 (date("") crashes). (Derick) - Fixed bug #33536 (strtotime() defaults to now even on non time string). (Derick) http://cvs.php.net/diff.php/php-src/ext/standard/streamsfuncs.c?r1=1.56&r2=1.57&ty=u Index: php-src/ext/standard/streamsfuncs.c diff -u php-src/ext/standard/streamsfuncs.c:1.56 php-src/ext/standard/streamsfuncs.c:1.57 --- php-src/ext/standard/streamsfuncs.c:1.56 Fri Jun 17 19:29:20 2005 +++ php-src/ext/standard/streamsfuncs.c Tue Jul 5 15:24:07 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streamsfuncs.c,v 1.56 2005/06/17 23:29:20 iliaa Exp $ */ +/* $Id: streamsfuncs.c,v 1.57 2005/07/05 19:24:07 iliaa Exp $ */ #include "php.h" #include "php_globals.h" @@ -1176,6 +1176,9 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The maximum allowed length must be greater then or equal to zero."); RETURN_FALSE; } + if (!max_length) { + max_length = PHP_SOCK_CHUNK_SIZE; + } php_stream_from_zval(stream, &zstream); http://cvs.php.net/co.php/php-src/ext/standard/tests/file/stream_get_line.phpt?r=1.1&p=1 Index: php-src/ext/standard/tests/file/stream_get_line.phpt +++ php-src/ext/standard/tests/file/stream_get_line.phpt --TEST-- Crash inside stream_get_line(), when length=0 --FILE-- <?php $path = dirname(__FILE__) . '/test.html'; file_put_contents($path, "foo<br>bar<br>foo"); $fp = fopen($path, "r"); while ($fp && !feof($fp)) { echo stream_get_line($fp, 0, "<br>")."\n"; } fclose($fp); @unlink($path); ?> --EXPECT-- foo bar foo -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php