#48081 [NEW]: stream_socket_client with SSL causes SEGFAULT
From: alexander at wright-family dot me dot uk
Operating system: Gentoo Linux
PHP version: 5.2.9
PHP Bug Type: Reproducible crash
Bug description: stream_socket_client with SSL causes SEGFAULT
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 bug report at http://bugs.php.net/?id=48081&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48081&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48081&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48081&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48081&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48081&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48081&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48081&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48081&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48081&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48081&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48081&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48081&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48081&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48081&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48081&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48081&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48081&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48081&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48081&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48081&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48081&r=mysqlcfg
Thread (8 messages)
- alexander at wright-family dot me dot uk