|  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
 [2017-01-03 04:23 UTC] dereckson at espace-win dot org
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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-09 08:31 UTC]
Automatic comment on behalf of
Log: Fixed bug #73854 (Always true condition in php_openssl_sockop_io)
 [2017-01-09 08:31 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Jan 21 16:01:23 2021 UTC