php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59130 Uninitialized tv.tv_usec causing PHP to loop endlessly.
Submitted: 2010-03-26 15:26 UTC Modified: 2010-03-26 15:46 UTC
From: vespian at wp dot pl Assigned:
Status: Closed Package: memcache (PECL)
PHP Version: 4.4.9 OS: Linux, all versions.
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: vespian at wp dot pl
New email:
PHP Version: OS:

 

 [2010-03-26 15:26 UTC] vespian at wp dot pl
Description:
------------
In function _mmc_open it is possible that a member of a  'struct timeval tv' will not get initialized. 

With PHP 5 it doesn`t matter really(there is no select) but in PHP series 4 it may cause an endless loop beacause the uninitialized value of a timeout sometimes causes select to fail. 

PHP`s 4 code () is not prepared for select`s return values smaller than 0 and loops endlessly.


Reproduce code:
---------------
Endless loop takes place at:

./main/network.c:1015

patch fixing this issue:

diff -Nwrup ./memcache-2.2.5_orig/memcache.c ./memcache-2.2.5/memcache.c
--- ./memcache-2.2.5_orig/memcache.c    2009-02-27 18:45:12.000000000 +0100
+++ ./memcache-2.2.5/memcache.c 2010-03-26 21:17:51.000000000 +0100
@@ -922,6 +922,7 @@ static int _mmc_open(mmc_t *mmc, char **
                tv = _convert_timeoutms_to_ts(mmc->connect_timeoutms);
        } else {
                tv.tv_sec = mmc->timeout;
+               tv.tv_usec = 0;
        }

        if (mmc->port) {



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-26 15:46 UTC] pierre dot php at gmail dot com
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.

Thanks for your feedback and patch!

Btw, you should consider to move to php 5.2+, php4 is not maintained anymore and future release of this extension may not support php4.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 20:01:29 2024 UTC