#48081 [Opn->Fbk]: stream_socket_client with SSL causes SEGFAULT
ID: 48081
Updated by: scottmac@php.net
Reported By: alexander at wright-family dot me dot uk
-Status: Open
+Status: Feedback
Bug Type: Reproducible crash
Operating System: Gentoo Linux
PHP Version: 5.2.9
Previous Comments:
------------------------------------------------------------------------
[2009-04-26 18:28:02] scottmac@php.net
Can you remove sushosin and get debug symbols for the rest of the php
binary.
I can't reproduce this on 5.2.10-dev or 5.3.0-dev
Output is:
Warning: stream_socket_client(): unable to connect to
ssl://www.google.com:443 (Operation now in progress) in
/private/tmp/test.php on line 7
Error:36: Operation now in progress
Headers:
------------------------------------------------------------------------
[2009-04-26 17:26:12] alexander at wright-family dot me dot uk
Description:
------------
PHPInfo located here:
http://www.wright-family.me.uk/shared/phpinfo.txt
Using hardened profile Gentoo Linux:
Linux beth 2.6.25-hardened-r11 #6 SMP Tue Dec 23 08:37:01 GMT 2008
x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 4200+ AuthenticAMD
GNU/Linux
Attached code causes a segfault when executing the
stream_socket_client() function.
Using TCP rather than SSL works correctly (i.e. without a segfault).
Reproduce code:
---------------
<?php
$context = stream_context_create();
$errno = 0;
$errstr = "";
$socket =
stream_socket_client('ssl://www.google.com:443',$errno,$errstr,60,STREAM_CLIENT_CONNECT,$context);
echo "\nError:{$errno}: {$errstr}\n";
while (($line = @fgets($socket)) !== false) {
if ($line) {
$response .= $line;
if (rtrim($line) === '') break;
}
}
echo "\n\nHeaders:\n{$response}\n\n";
?>
Expected result:
----------------
Code should connect to google, and attempt to read some data.
Actual result:
--------------
Backtrace:
#0 0xffffffffff70085e in ?? ()
#1 0x00006f972c5797f2 in gettimeofday ()
#2 0x00006f97251c32ba in gettimeofday () from /lib/libc.so.6
#3 0x000005b28362a9f0 in ?? () from /usr/lib64/php5/bin/php
#4 0x000005b28362a2a5 in ?? () from /usr/lib64/php5/bin/php
#5 0x000005b2839cec4f in _php_stream_set_option () from
/usr/lib64/php5/bin/php
#6 0x000005b2839e0cbf in php_stream_xport_crypto_enable () from
/usr/lib64/php5/bin/php
#7 0x000005b28362a361 in ?? () from /usr/lib64/php5/bin/php
#8 0x000005b2839cec4f in _php_stream_set_option () from
/usr/lib64/php5/bin/php
#9 0x000005b2839e0718 in php_stream_xport_connect () from
/usr/lib64/php5/bin/php
#10 0x000005b2839e0229 in _php_stream_xport_create () from
/usr/lib64/php5/bin/php
#11 0x000005b28396a9e3 in zif_stream_socket_client () from
/usr/lib64/php5/bin/php
#12 0x000005b283a5f371 in execute_internal () from
/usr/lib64/php5/bin/php
#13 0x00006f9724b0f5dd in ?? () from
/usr/lib64/php5/lib/php/extensions/debug-zts-20060613/suhosin.so
#14 0x000005b283a5fe93 in ?? () from /usr/lib64/php5/bin/php
#15 0x000005b283a67e4c in ?? () from /usr/lib64/php5/bin/php
#16 0x000005b283a5f7ac in execute () from /usr/lib64/php5/bin/php
#17 0x00006f9724b0c6eb in ?? () from
/usr/lib64/php5/lib/php/extensions/debug-zts-20060613/suhosin.so
#18 0x00006f9724b0c785 in ?? () from
/usr/lib64/php5/lib/php/extensions/debug-zts-20060613/suhosin.so
#19 0x000005b283a2c0fe in zend_execute_scripts () from
/usr/lib64/php5/bin/php
#20 0x000005b2839ab8ed in php_execute_script () from
/usr/lib64/php5/bin/php
#21 0x000005b283adb1a3 in main () from /usr/lib64/php5/bin/php
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48081&edit=1
Thread (8 messages)