php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66388 Crash on POST with Content-Length:0 and untouched body
Submitted: 2014-01-02 06:16 UTC Modified: 2014-01-02 15:35 UTC
From: sudocoder at ymail dot com Assigned: mike (profile)
Status: Closed Package: pecl_http (PECL)
PHP Version: 5.4.23 OS: Ubuntu 12.04
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sudocoder at ymail dot com
New email:
PHP Version: OS:

 

 [2014-01-02 06:16 UTC] sudocoder at ymail dot com
Description:
------------
I ran into a segfault while trying to send a GET/POST request to an HTTPS endpoint. Here is some additional information regarding my setup:

HTTP Support	enabled
Extension Version	2.0.3

Used Library	Compiled	Linked
libz	1.2.3.4	1.2.3.4
libcurl	7.22.0	7.22.0
libevent	disabled	disabled

Directive	Local Value	Master Value
http.etag.mode	crc32b	crc32b

Server version: Apache/2.2.22 (Ubuntu)

Test script:
---------------
<?php

    use http\Client,
        http\Client\Request;

    $client = new Client();
    $request = new Request('GET', 'https://google.com/');
    $client->enqueue($request);
    $client->send();

?>

Expected result:
----------------
Expected to get Google

Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
0xb5d6b120 in _php_stream_read () from /usr/lib/apache2/modules/libphp5.so
(gdb) bt
#0  0xb5d6b120 in _php_stream_read () from /usr/lib/apache2/modules/libphp5.so
#1  0xb59a6685 in php_http_curle_read_callback (data=0xb8b16101, len=1, n=16384,
    ctx=0xb7620ac0) at /tmp/pear/temp/pecl_http/php_http_client_curl.c:181
#2  0xb6b1458f in Curl_fillreadbuffer () from /usr/lib/i386-linux-gnu/libcurl.so.4
#3  0xb6b15301 in Curl_readwrite () from /usr/lib/i386-linux-gnu/libcurl.so.4
#4  0xb6b1f5e8 in ?? () from /usr/lib/i386-linux-gnu/libcurl.so.4
#5  0xb6b1fbdc in curl_multi_perform () from /usr/lib/i386-linux-gnu/libcurl.so.4
#6  0xb59a778f in php_http_client_curl_once (h=0xb6cac550)
    at /tmp/pear/temp/pecl_http/php_http_client_curl.c:1762
#7  0xb59a79d4 in php_http_client_curl_exec (h=0xb6cac550)
    at /tmp/pear/temp/pecl_http/php_http_client_curl.c:1795
#8  0xb59a40b6 in php_http_client_exec (h=0xb6cac550)
    at /tmp/pear/temp/pecl_http/php_http_client.c:291
#9  0xb59a416f in zim_HttpClient_send (ht=0, return_value=0xb6cac7e0,
    return_value_ptr=0x0, this_ptr=0xb6cac31c, return_value_used=0)
    at /tmp/pear/temp/pecl_http/php_http_client.c:794
#10 0xb5e674d6 in ?? () from /usr/lib/apache2/modules/libphp5.so
#11 0xb5e230b5 in execute () from /usr/lib/apache2/modules/libphp5.so
#12 0xb5db92b9 in zend_execute_scripts () from /usr/lib/apache2/modules/libphp5.so
#13 0xb5d52eee in php_execute_script () from /usr/lib/apache2/modules/libphp5.so

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-01-02 06:28 UTC] sudocoder at ymail dot com
-Status: Open +Status: Closed
 [2014-01-02 06:28 UTC] sudocoder at ymail dot com
Nevermind.. just had to install libevent
 [2014-01-02 10:40 UTC] mike@php.net
-Status: Closed +Status: Re-Opened -Assigned To: +Assigned To: mike
 [2014-01-02 10:40 UTC] mike@php.net
Sounds like some configure/build bug then, though.
I'll have a closer look.
 [2014-01-02 14:35 UTC] sudocoder at ymail dot com
I've been running into segfaults again and managed to duplicate the issue on both Ubuntu and Mac OSX (both running pecl_http 2.0.3 and php 5.4.23) with the following code. 

<?php

    use http\Client,
        http\Client\Request;

    $client = new Client();
    $request = new Request(
        'POST',
        'https://api.twitter.com/oauth/request_token',
        array(
            'Content-Length' => 0
        )
    );
    $client->enqueue($request);
    $client->send();

?>

GDB backtrace (Ubuntu):

Program received signal SIGSEGV, Segmentation fault.
0xb5d0c120 in _php_stream_read () from /usr/lib/apache2/modules/libphp5.so
(gdb) bt
#0  0xb5d0c120 in _php_stream_read () from /usr/lib/apache2/modules/libphp5.so
#1  0xb5947685 in php_http_curle_read_callback (data=0xb8ac2109, len=1, n=16384,
    ctx=0xb75c1ac0) at /tmp/pear/temp/pecl_http/php_http_client_curl.c:181
#2  0xb6ab558f in Curl_fillreadbuffer () from /usr/lib/i386-linux-gnu/libcurl.so.4
#3  0xb6ab6301 in Curl_readwrite () from /usr/lib/i386-linux-gnu/libcurl.so.4
#4  0xb6ac05e8 in ?? () from /usr/lib/i386-linux-gnu/libcurl.so.4
#5  0xb6ac0bdc in curl_multi_perform () from /usr/lib/i386-linux-gnu/libcurl.so.4
#6  0xb594878f in php_http_client_curl_once (h=0xb6c4cce4)
    at /tmp/pear/temp/pecl_http/php_http_client_curl.c:1762
#7  0xb59489d4 in php_http_client_curl_exec (h=0xb6c4cce4)
    at /tmp/pear/temp/pecl_http/php_http_client_curl.c:1795
#8  0xb59450b6 in php_http_client_exec (h=0xb6c4cce4)
    at /tmp/pear/temp/pecl_http/php_http_client.c:291
#9  0xb594516f in zim_HttpClient_send (ht=0, return_value=0xb6c4d8d0,
    return_value_ptr=0x0, this_ptr=0xb6c4d40c, return_value_used=0)
    at /tmp/pear/temp/pecl_http/php_http_client.c:794
#10 0xb5e084d6 in ?? () from /usr/lib/apache2/modules/libphp5.so
#11 0xb5dc40b5 in execute () from /usr/lib/apache2/modules/libphp5.so
#12 0xb5d5a2b9 in zend_execute_scripts () from /usr/lib/apache2/modules/libphp5.so
#13 0xb5cf3eee in php_execute_script () from /usr/lib/apache2/modules/libphp5.so
#14 0xb5e0afa0 in ?? () from /usr/lib/apache2/modules/libphp5.so
#15 0xb76d675e in ap_run_handler ()
#16 0xb76d6bd6 in ap_invoke_handler ()
#17 0xb76e8a08 in ap_process_request ()
#18 0xb76e54c0 in ?? ()
#19 0xb76ddd2e in ap_run_process_connection ()
#20 0xb76ee2e5 in ?? ()
#21 0xb76eebf9 in ?? ()
#22 0xb76ef4bf in ap_mpm_run ()
#23 0xb76bf78d in main ()
 [2014-01-02 15:05 UTC] mike@php.net
-Summary: Segmentation fault when sending request to HTTPS +Summary: Crash on POST with Content-Length:0 and untouched body
 [2014-01-02 15:05 UTC] mike@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=pecl/http/pecl_http.git;a=commit;h=71404a21e0937944e47a760e8736905c75f903ea
Log: fix bug #66388 (Crash on POST with Content-Length:0 and untouched body)
 [2014-01-02 15:05 UTC] mike@php.net
-Status: Re-Opened +Status: Closed
 [2014-01-02 15:35 UTC] mike@php.net
Released 2.0.4 with a fix.

Thank you!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 02:01:28 2024 UTC