From:             vnegrier at optilian dot com
Operating system: linux 2.6
PHP version:      5.2.6
PHP Bug Type:     OpenSSL related
Bug description:  timeout bug in stream_socket_enable_crypto

Description:
------------
there's a bug in the stream_socket_enable_crypto() timeout test: the
"timeout" var is only decremented when tve.sec and tvs.sec differ because
(at least with gcc-4.3.1) "tv_usec / 1000000" is cast as int, leading to
timeout inaccuracy, fix below :

--- xp_ssl.c.orig       2008-06-27 21:02:58.000000000 +0200
+++ xp_ssl.c    2008-06-27 21:03:07.000000000 +0200
@@ -418,7 +418,7 @@
                                n = SSL_connect(sslsock->ssl_handle);
                                gettimeofday(&tve, &tz);

-                               timeout -= (tve.tv_sec + tve.tv_usec /
1000000) - (tvs.tv_sec + tvs.tv_usec / 1000000);
+                               timeout -= (tve.tv_sec +
(float)tve.tv_usec / 1000000) - (tvs.tv_sec + (float)tvs.tv_usec /
1000000);
                                if (timeout < 0) {
                                        php_error_docref(NULL TSRMLS_CC,
E_WARNING, "SSL: connection timeout");
                                        return -1;



-- 
Edit bug report at http://bugs.php.net/?id=45382&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45382&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45382&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45382&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45382&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45382&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45382&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45382&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45382&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45382&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45382&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45382&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45382&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45382&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45382&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45382&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45382&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45382&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45382&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45382&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45382&r=mysqlcfg

Reply via email to