php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73854 Always true condition in php_openssl_sockop_io
Submitted: 2017-01-03 04:23 UTC Modified: -
From: dereckson at espace-win dot org Assigned:
Status: Closed Package: OpenSSL related
PHP Version: 7.1Git-2017-01-03 (Git) OS: FreeBSD
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dereckson at espace-win dot org
New email:
PHP Version: OS:

 

 [2017-01-03 04:23 UTC] dereckson at espace-win dot org
Description:
------------
Commit bbfd4a5e62c offers to "fix crypto stream timeout regressions".


It introduces the following  code snippet in php_openssl_sockop_io function:

               /* never use a timeout with non-blocking sockets */
               if (began_blocked && &sslsock->s.timeout) {
                       timeout = &sslsock->s.timeout;
               }

(currently in ext/openssl/xp_ssl.c around line 1910)

This condition will be always true, as this syntax means "take the address of sslsock->s.timeout".

This is caught by clang/llvm compiler:

/home/dereckson/dev/php/php-src/ext/openssl/xp_ssl.c:1908:36: warning: address of 'sslsock->s.timeout' will always evaluate to 'true' [-Wpointer-bool-conversion]
                if (began_blocked && &sslsock->s.timeout) {
                                  ~~  ~~~~~~~~~~~^~~~~~~
1 warning generated.


Expected result:
----------------
To get the timeout value

Actual result:
--------------
Always true, as it gets the address

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-09 08:31 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f7cb79431f621381722f504e75d1e71e72df6de9
Log: Fixed bug #73854 (Always true condition in php_openssl_sockop_io)
 [2017-01-09 08:31 UTC] laruence@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Jan 21 16:01:23 2021 UTC