Bug #72689 [NEW]: php with curl extension segfaults for https
| From: | php at andreas-borchert dot de | Date: | Wed, 27 Jul 2016 18:34:25 +0000 |
| Subject: | Bug #72689 [NEW]: php with curl extension segfaults for https | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-202646@lists.php.net to get a copy of this message | ||
From: php at andreas-borchert dot de
Operating system: Solaris 10
PHP version: 5.6.24
Package: cURL related
Bug Type: Bug
Bug description:php with curl extension segfaults for https
Description:
------------
php 5.6.24 with curl and mysql extension segfaults when I attempt to
retrieve an https document. http and other protocols work fine.
Everything was built from sources using gcc 4.8.0 on a SPARC/Solaris 10
platform.
The crash can be triggered by invoking php at the command line with the
test script below.
The crash occurs shortly after the SSL certificates have been read. Here
is an excerpt from truss (tool similar to strace):
open64("/usr/local/gcc48/openssl/cert.pem", O_RDONLY) = 4
fstat64(4, 0xFFBFD770) = 0
brk(0x00DB1C40) = 0
brk(0x00DC1C40) = 0
fstat64(4, 0xFFBFD618) = 0
ioctl(4, TCGETA, 0xFFBFD6FC) Err#25 ENOTTY
read(4, " # #\n # # B u n d l e".., 131072) = 131072
brk(0x00DC1C40) = 0
# ... many more brk system calls
read(4, 0x00DA070C, 131072) = 0
llseek(4, 0, SEEK_CUR) = 250615
close(4) = 0
Incurred fault #6, FLTBOUNDS %pc = 0x004CA154
siginfo: SIGSEGV SEGV_ACCERR addr=0xFEF57A5C
Received signal #11, SIGSEGV [default]
siginfo: SIGSEGV SEGV_ACCERR addr=0xFEF57A5C
Test script:
---------------
<?php
$ch = curl_init("https://de.wikipedia.org/wiki/Ulm");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
if (!$content = curl_exec($ch)) {
echo "FAILED:";
trigger_error(curl_error($ch));
} else {
echo "OK:";
echo $content;
}
curl_close($ch);
?>
Actual result:
--------------
clonard$ gdb /usr/local/php-5.6.24/bin/php
GNU gdb (GDB) 7.5.1
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show
copying"
and "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.10".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/local/php-5.6.24/bin/php...done.
(gdb) run test.php
Starting program: /usr/local/php-5.6.24/bin/php test.php
[Thread debugging using libthread_db enabled]
[New Thread 1 (LWP 1)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1 (LWP 1)]
0x004ca154 in CRYPTO_add_lock ()
(gdb) where
#0 0x004ca154 in CRYPTO_add_lock ()
#1 0x004c1a7c in ssl_cert_dup ()
#2 0x004c05a4 in SSL_new ()
#3 0xfef59858 in ossl_connect_common () from
/usr/local/gcc48/lib/libcurl.so.4
#4 0xfef5b268 in Curl_ssl_connect_nonblocking ()
from /usr/local/gcc48/lib/libcurl.so.4
#5 0xfef1e148 in Curl_http_connect () from
/usr/local/gcc48/lib/libcurl.so.4
#6 0xfef2cd18 in Curl_protocol_connect ()
from /usr/local/gcc48/lib/libcurl.so.4
#7 0xfef3fad8 in multi_runsingle () from
/usr/local/gcc48/lib/libcurl.so.4
#8 0xfef40678 in curl_multi_perform () from
/usr/local/gcc48/lib/libcurl.so.4
#9 0xfef38344 in curl_easy_perform () from
/usr/local/gcc48/lib/libcurl.so.4
#10 0x0019c99c in zif_curl_exec (ht=1, return_value=0xb57a28,
return_value_ptr=0xb3c87c, this_ptr=0x0,
return_value_used=<optimized out>, tsrm_ls=0xb391f0)
at /var/playground/ULMphp/src/php-5.6.24/ext/curl/interface.c:2986
#11 0x00496574 in zend_do_fcall_common_helper_SPEC
(execute_data=0xb3c8d8,
tsrm_ls=0xb391f0)
at /var/playground/ULMphp/src/php-5.6.24/Zend/zend_vm_execute.h:558
#12 0x00410e6c in execute_ex (execute_data=0xb3c8d8, tsrm_ls=0xb391f0)
at /var/playground/ULMphp/src/php-5.6.24/Zend/zend_vm_execute.h:363
#13 0x00493e90 in zend_execute (op_array=0xb57390,
tsrm_ls=tsrm_ls@entry=0xb391f0)
---Type <return> to continue, or q <return> to quit---
at /var/playground/ULMphp/src/php-5.6.24/Zend/zend_vm_execute.h:388
#14 0x003d3d9c in zend_execute_scripts (type=type@entry=8,
tsrm_ls=tsrm_ls@entry=0xb391f0, retval=retval@entry=0x0,
file_count=file_count@entry=3)
at /var/playground/ULMphp/src/php-5.6.24/Zend/zend.c:1341
#15 0x00359cb0 in php_execute_script (
primary_file=primary_file@entry=0xffbfee48,
tsrm_ls=tsrm_ls@entry=0xb391f0)
at /var/playground/ULMphp/src/php-5.6.24/main/main.c:2613
#16 0x0049875c in do_cli (argc=2, argv=0xb391a8, tsrm_ls=0xb391f0)
at /var/playground/ULMphp/src/php-5.6.24/sapi/cli/php_cli.c:994
#17 0x0005cdf0 in main (argc=2, argv=<optimized out>)
at /var/playground/ULMphp/src/php-5.6.24/sapi/cli/php_cli.c:1378
(gdb)
--
Edit bug report at https://bugs.php.net/bug.php?id=72689&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72689&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72689&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72689&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72689&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72689&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72689&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72689&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72689&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72689&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72689&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72689&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72689&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72689&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72689&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72689&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72689&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72689&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72689&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72689&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72689&r=mysqlcfg