|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22753 size_t unsigned error causes endless loop
Submitted: 2003-03-17 14:42 UTC Modified: 2003-03-18 09:09 UTC
From: hak at cooper dot edu Assigned: wez (profile)
Status: Closed Package: Reproducible crash
PHP Version: 4CVS-2003-03-17 (stable) OS: Linux 2.4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
17 + 45 = ?
Subscribe to this entry?

 [2003-03-17 14:42 UTC] 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;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-17 19:53 UTC]
Assigned to Wez, must be fixed for PHP 4.3.2.

 [2003-03-18 09:09 UTC]
Already fixed in CVS as the reporter stated.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Mar 22 19:03:40 2023 UTC