|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38631 fopen('https://...') or curl with https gives Segmentation fault
Submitted: 2006-08-28 16:09 UTC Modified: 2006-12-30 06:21 UTC
From: roberto dot berto at gmail dot com Assigned:
Status: Not a bug Package: cURL related
PHP Version: 4.4.4 OS: RHEL3
Private report: No CVE-ID: None
 [2006-08-28 16:09 UTC] roberto dot berto at gmail dot com
While using fopen or CURL with https:// PHP returns 'Segmentation fault'

Reproduce code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://foo/');


print join('', file('htps://foo'));

PHP compile:
'./configure' '--with-apxs=/usr/local/apache/bin/apxs' '--prefix=/usr/local' '--with-xml' '--enable-bcmath' '--enable-calendar' '--with-curl' '--with-dom' '--with-dom-xslt' '--with-dom-exslt' '--enable-exif' '--enable-ftp' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr' '--with-xpm-dir=/usr/X11R6' '--with-gettext' '--with-iconv' '--with-imap=/usr/local/imap-2004g' '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-mcrypt' '--enable-magic-quotes' '--with-mysqli' '--with-mysql=/usr' '--with-openssl' '--enable-discard-path' '--with-pear' '--with-pgsql=/usr' '--enable-xslt' '--with-xslt-sablot' '--enable-safe-mode' '--enable-sockets' '--enable-track-vars' '--with-ttf' '--with-freetype-dir=/usr' '--enable-gd-native-ttf'
'--enable-versioning' '--with-xmlrpc' '--with-zip' '--with-zlib'

Expected result:
Return url content

Actual result:
For file():

#0  0x00508272 in BN_num_bits () from /usr/lib/
#1  0x0054d1d0 in X509_ATTRIBUTE_create () from /usr/lib/
#2  0x00553fc5 in asn1_ex_i2c () from /usr/lib/
#3  0x00553d31 in ASN1_template_i2d () from /usr/lib/
#4  0x00553437 in ASN1_item_ex_i2d () from /usr/lib/
#5  0x00553968 in ASN1_template_i2d () from /usr/lib/
#6  0x00553500 in ASN1_item_ex_i2d () from /usr/lib/
#7  0x005532cd in ASN1_item_i2d () from /usr/lib/
#8  0x00518db0 in i2d_DHparams () from /usr/lib/
#9  0x00548dba in ASN1_dup () from /usr/lib/
#10 0x001b1ade in ssl3_connect () from /usr/lib/
#11 0x001af9cf in ssl3_connect () from /usr/lib/
#12 0x001bbcda in SSL_connect () from /usr/lib/
#13 0x001b884b in ssl23_connect () from /usr/lib/
#14 0x001b8337 in ssl23_connect () from /usr/lib/
#15 0x001bbcda in SSL_connect () from /usr/lib/
#16 0x0819dca7 in php_stream_sock_ssl_activate_with_method (stream=0x890c4b0, activate=1, method=0x1d0ca0, session_stream=0x890b258)
    at /home/cpapachebuild/buildapache/php-4.4.3/main/network.c:766
#17 0x08166eb4 in php_stream_url_wrap_http_ex (wrapper=0x889ed38, path=0x8902fe4 "https://foo",
    mode=0x82172e0 "rb", options=4, opened_path=0x0, context=0x0, redirect_max=20, header_init=1)
    at /home/cpapachebuild/buildapache/php-4.4.3/ext/standard/http_fopen_wrapper.c:160
#18 0x081682ad in php_stream_url_wrap_http (wrapper=0x889ed38, path=0x8902fe4 "https://foo", mode=0x82172e0 "rb",
    options=4, opened_path=0x0, context=0x0) at /home/cpapachebuild/buildapache/php-4.4.3/ext/standard/http_fopen_wrapper.c:563
#19 0x0819ce4c in _php_stream_open_wrapper_ex (path=0x8902fe4 "https://foo", mode=0x82172e0 "rb", options=12,
    opened_path=0x4, context=0x0) at /home/cpapachebuild/buildapache/php-4.4.3/main/streams.c:2696
#20 0x08137f8b in zif_file (ht=1, return_value=0x89071bc, this_ptr=0x0, return_value_used=1)
    at /home/cpapachebuild/buildapache/php-4.4.3/ext/standard/file.c:498
#21 0x081c15ee in execute (op_array=0x8907664) at /home/cpapachebuild/buildapache/php-4.4.3/Zend/zend_execute.c:1675
#22 0x081b4df7 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/cpapachebuild/buildapache/php-4.4.3/Zend/zend.c:934
#23 0x08191587 in php_execute_script (primary_file=0xbfffbb80) at /home/cpapachebuild/buildapache/php-4.4.3/main/main.c:1752
#24 0x081c55a0 in main (argc=2, argv=0xbfffbc44) at /home/cpapachebuild/buildapache/php-4.4.3/sapi/cli/php_cli.c:832

For curl:

#0  0x0052b481 in __pause_nocancel () from /lib/tls/
#1  0x00bee6c9 in zend_oe () from /usr/local/Zend/lib/Optimizer-3.0.1/php-4.4.x/
#2  <signal handler called>
#3  0x00860272 in BN_num_bits () from /usr/lib/
#4  0x008a51d0 in X509_ATTRIBUTE_create () from /usr/lib/
#5  0x008abfc5 in asn1_ex_i2c () from /usr/lib/
#6  0x008abd31 in ASN1_template_i2d () from /usr/lib/
#7  0x008ab437 in ASN1_item_ex_i2d () from /usr/lib/
#8  0x008ab968 in ASN1_template_i2d () from /usr/lib/
#9  0x008ab500 in ASN1_item_ex_i2d () from /usr/lib/
#10 0x008ab2cd in ASN1_item_i2d () from /usr/lib/
#11 0x00870db0 in i2d_DHparams () from /usr/lib/
#12 0x008a0dba in ASN1_dup () from /usr/lib/
#13 0x00705ade in ssl3_connect () from /usr/lib/
#14 0x007039cf in ssl3_connect () from /usr/lib/
#15 0x0070fcda in SSL_connect () from /usr/lib/
#16 0x0070c84b in ssl23_connect () from /usr/lib/
#17 0x0070c337 in ssl23_connect () from /usr/lib/
#18 0x0070fcda in SSL_connect () from /usr/lib/
#19 0x0046bd37 in Curl_ossl_connect (conn=0x9aa2288, sockindex=162398240) at ssluse.c:1338
#20 0x00478379 in Curl_ssl_connect (conn=0x9ae06d0, sockindex=16085786) at sslgen.c:203
#21 0x0045e453 in Curl_http_connect (conn=0x9aa2288, done=0x9ae0020 " ") at http.c:1376
#22 0x00467705 in Curl_protocol_connect (conn=0x9aa2288, protocol_done=0xbfff88ab "") at url.c:2381
#23 0x004696d1 in SetupConnection (conn=0x9aa2288, hostaddr=0x9a0d2b0, protocol_done=0xbfff88ab "") at url.c:3878
#24 0x0046976b in Curl_connect (data=0x9aa76e0, in_connect=0xbfff88e8, asyncp=0xbfff88aa "", protocol_done=0xbfff88ab "") at url.c:3934
#25 0x0047225b in Curl_connect_host (data=0x9aa76e0, conn=0xbfff88e8) at transfer.c:2064
#26 0x00472414 in Curl_perform (data=0x9aa76e0) at transfer.c:2153
#27 0x00472b1b in curl_easy_perform (curl=0x9aa76e0) at easy.c:445
#28 0x080a75da in zif_curl_exec (ht=1, return_value=0x9a9d1dc, this_ptr=0x0, return_value_used=0)
    at /home/cpapachebuild/buildapache/php-4.4.3/ext/curl/curl.c:1276
#29 0x00b64293 in zend_oe () from /usr/local/Zend/lib/Optimizer-3.0.1/php-4.4.x/
#30 0x00b60a4c in zend_oe () from /usr/local/Zend/lib/Optimizer-3.0.1/php-4.4.x/
#31 0x081b4df7 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/cpapachebuild/buildapache/php-4.4.3/Zend/zend.c:934
#32 0x08191587 in php_execute_script (primary_file=0xbfffb150) at /home/cpapachebuild/buildapache/php-4.4.3/main/main.c:1752
#33 0x081c55a0 in main (argc=2, argv=0xbfffb214) at /home/cpapachebuild/buildapache/php-4.4.3/sapi/cli/php_cli.c:832


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-28 16:14 UTC]
The backtrace clearly shows that it's not PHP problem.
 [2006-12-30 06:20 UTC]
Duplicate of
 [2006-12-30 06:21 UTC]
Duplicate of
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Mar 08 01:01:24 2021 UTC