php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18036 Curl_exec segfault
Submitted: 2002-06-28 01:41 UTC Modified: 2002-07-03 07:50 UTC
From: nuitari at darklands dot cx Assigned:
Status: Not a bug Package: cURL related
PHP Version: 4.2.1 OS: Linux
Private report: No CVE-ID: None
 [2002-06-28 01:41 UTC] nuitari at darklands dot cx
PHP will cause a segmentation fault if CURL_POST is set to 1, but there is no CURL_POSTFIELDS set.

Sorry if this has already been reported before, I tried searching for it, but might have missed it. 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-28 02:09 UTC] sniper@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.


Which version of curl libraries is your php compiled with?


 [2002-06-28 02:49 UTC] nuitari at darklands dot cx
libcurl 7.9.8
Error was also in 7.9.7
I don't know for earlier versions.

Sample php script:
<?
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL,"http://www.google.com");
curl_setopt ($ch, CURLOPT_POST, 1);
curl_exec($ch);
?>

strace info snippet:
send(3, "POST / HTTP/1.1\r\nHost: www.googl"..., 193, 0) = 193
gettimeofday({1025268846, 532533}, NULL) = 0
gettimeofday({1025268846, 532555}, NULL) = 0
select(4, [3], [3], NULL, {1, 0})       = 1 (out [3], left {1, 0})
gettimeofday({1025268846, 532760}, NULL) = 0
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++

Here is the back trace:
(gdb) bt
#0  0x404e2016 in _IO_fread (buf=0x82bd9d9, size=1, count=20480, fp=0x0)
    at iofread.c:42
#1  0x0808248c in curl_read (data=0x82bd9d9 "", size=1, nmemb=20480, 
    ctx=0x82b771c) at curl.c:350
#2  0x4031d190 in Curl_readwrite (conn=0x82b7b10, done=0xbfffdc2f "")
    at transfer.c:808
#3  0x4031d9ca in Transfer (conn=0x82b7b10) at transfer.c:1093
#4  0x4031ddc6 in Curl_perform (data=0x82b8380) at transfer.c:1180
#5  0x4031e176 in curl_easy_perform (curl=0x82b8380) at easy.c:245
#6  0x08083972 in zif_curl_exec (ht=1, return_value=0x82b7964, this_ptr=0x0, 
    return_value_used=0) at curl.c:876
#7  0x08150440 in execute (op_array=0x82b3134) at ./zend_execute.c:1598
#8  0x08129cc2 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at zend.c:810
#9  0x08075351 in php_execute_script (primary_file=0xbffffa40) at main.c:1381
#10 0x0807335c in main (argc=2, argv=0xbffffae4) at cgi_main.c:778
#11 0x4048c627 in __libc_start_main (main=0x8072b54 <main>, argc=2, 
    ubp_av=0xbffffae4, init=0x8070864 <_init>, fini=0x81a9030 <_fini>, 
    rtld_fini=0x4000dcc4 <_dl_fini>, stack_end=0xbffffadc)
    at ../sysdeps/generic/libc-start.c:129

(gdb) frame 0
#0  0x404e2016 in _IO_fread (buf=0x82bd9d9, size=1, count=20480, fp=0x0)
    at iofread.c:42
42      in iofread.c
(gdb) frame 1
#1  0x0808248c in curl_read (data=0x82bd9d9 "", size=1, nmemb=20480, 
    ctx=0x82b771c) at curl.c:350
350     curl.c:  No such file or directory.
        in curl.c

(gdb) frame 7
#7  0x08150440 in execute (op_array=0x82b3134) at ./zend_execute.c:1598
1598    ./zend_execute.c: No such file or directory.
        in ./zend_execute.c
 [2002-06-28 03:41 UTC] sniper@php.net
Doesn't segfault for me with PHP 4.3.0-dev and curl 7.9.5.
Can you please try the latest snapshot:

http://snaps.php.net/php4-latest.tar.gz

(with your installed curl library)


 [2002-06-28 03:43 UTC] edink@php.net
This might be related to http://bugs.php.net/bug.php?id=17240 . The cURL's author of reported the problem solved in 7.9.8. From the backtrace it sure looks like the problem is in libcurl.
 [2002-07-02 21:50 UTC] sniper@php.net
still no feedback..

 [2002-07-03 07:50 UTC] sterling@php.net
Not a php bug, and its fixed in cURL.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Sep 15 20:01:27 2019 UTC