#22753 [Opn->Asn]: size_t unsigned error causes endless loop
| From: | sniper@php.net | Date: | Tue, 18 Mar 2003 01:53:20 +0000 |
| Subject: | #22753 [Opn->Asn]: size_t unsigned error causes endless loop | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-35785@lists.php.net to get a copy of this message | ||
ID: 22753
Updated by: sniper@php.net
Reported By: hak at cooper dot edu
-Status: Open
+Status: Assigned
Bug Type: Reproducible crash
Operating System: Linux 2.4
PHP Version: 4CVS-2003-03-17 (stable)
-Assigned To:
+Assigned To: wez
New Comment:
Assigned to Wez, must be fixed for PHP 4.3.2.
Previous Comments:
------------------------------------------------------------------------
[2003-03-17 14:42:38] hak at cooper dot edu
Diffing between 4.3.1 and Mar 13 STABLE it appears
you are already working on this bug. In network.c:
php_sockop_write, you had previously declared didwrite
as size_t, which is unsigned on some OS (e.g. Linux).
Therefore, an error in the send system call was not
detected. The STABLE release changes didwrite to an
int but in streams.c:_php_stream_write, the return
value still gets assigned into size_t justwrote, and
therefore you get stuck in an endless loop because the
check justwrote>0 i.e. (unsigned)0xFFFFFFFF>0 is true.
Fix is to either change justwrote to an int, or
to add the following to the end of sockop_write:
return didwrite<0?0:didwrite;
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22753&edit=1