php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62839 curl_copy_handle segfault with CURLOPT_FILE
Submitted: 2012-08-16 13:58 UTC Modified: 2012-08-16 18:53 UTC
From: martin at mixotv dot com Assigned: pierrick (profile)
Status: Closed Package: cURL related
PHP Version: 5.4.5 OS: Linux 3.4.8-1
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: martin at mixotv dot com
New email:
PHP Version: OS:

 

 [2012-08-16 13:58 UTC] martin at mixotv dot com
Description:
------------
When using cURL with the option CURLOPT_FILE (write the result of the curl request in a file), curl_copy_handle() causes a SEGFAULT.

I use the packages from Archlinux repository (php, libcurl 7.27.0 x86_64).

I get the same results with a current ubuntu distribution.

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

$curl = curl_init();

$fd = fopen('/tmp/test', 'wb');
curl_setopt($curl, CURLOPT_FILE, $fd);

$copy = curl_copy_handle($curl);

var_dump($copy);

curl_close($copy);
curl_close($curl);
fclose($fd);

Expected result:
----------------
no segfault

Actual result:
--------------
segfault:

#0  0x00007ffff5ca6f46 in ?? () from /usr/lib/php/modules/curl.so
#1  0x00007ffff5ec0f0d in xdebug_execute_internal () from /usr/lib/php/modules/xdebug.so
#2  0x00000000006dac6d in ?? ()
#3  0x00000000006946ff in execute ()
#4  0x00007ffff5ec1392 in xdebug_execute () from /usr/lib/php/modules/xdebug.so
#5  0x00000000006355d9 in zend_execute_scripts ()
#6  0x00000000005d5393 in php_execute_script ()
#7  0x00000000006dd433 in ?? ()
#8  0x000000000042601a in ?? ()
#9  0x00007ffff692d725 in __libc_start_main () from /lib/libc.so.6
#10 0x00000000004260ad in _start ()

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-16 14:09 UTC] felipe@php.net
-Status: Open +Status: Feedback
 [2012-08-16 14:09 UTC] felipe@php.net
Try disabling xdebug.
 [2012-08-16 14:17 UTC] martin at mixotv dot com
-Status: Feedback +Status: Open
 [2012-08-16 14:17 UTC] martin at mixotv dot com
Hi Felipe,

Here is the backtrace without Xdebug:

Program received signal SIGSEGV, Segmentation fault.
#0  0x00007ffff5ed9f46 in ?? () from /usr/lib/php/modules/curl.so
#1  0x00000000006dae02 in ?? ()
#2  0x00000000006946ff in execute ()
#3  0x00000000006355d9 in zend_execute_scripts ()
#4  0x00000000005d5393 in php_execute_script ()
#5  0x00000000006dd433 in ?? ()
#6  0x000000000042601a in ?? ()
#7  0x00007ffff692d725 in __libc_start_main () from /lib/libc.so.6
#8  0x00000000004260ad in _start ()
 [2012-08-16 15:04 UTC] pierrick@php.net
-Assigned To: +Assigned To: pierrick
 [2012-08-16 18:52 UTC] pierrick@php.net
Automatic comment on behalf of pierrick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=9cf0139460c7531ebe8fdd523ba6cf7067a7f282
Log: Fixed bug #62839
 [2012-08-16 18:53 UTC] pierrick@php.net
-Status: Assigned +Status: Closed
 [2012-08-16 18:53 UTC] pierrick@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2012-09-18 02:47 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e66a5ce56fc9be74096e0d0452a1172c8130752c
Log: Fixed Bug #63103 (ext\curl\tests\bug62839.phpt broken)
 [2012-09-18 02:48 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e66a5ce56fc9be74096e0d0452a1172c8130752c
Log: Fixed Bug #63103 (ext\curl\tests\bug62839.phpt broken)
 [2012-09-18 02:50 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e66a5ce56fc9be74096e0d0452a1172c8130752c
Log: Fixed Bug #63103 (ext\curl\tests\bug62839.phpt broken)
 [2013-07-18 08:41 UTC] lixiuqiu55 at outlook dot com
From the shape  it is easy to see, this war boots set the ventilation and comfort all in one,http://www.suprahommepascher.fr/nike-air-max-1-c-14.html  under more suitable for athletes on the field when relaxing. Large areas of breathable mesh material on the uppers decided those shoes on during the summer Olympics, you can make players http://www.suprahommepascher.fr/nike-air-max-90-c-27.html feel more comfortable,air max 90 femme   equipped with the Palm at the end of IP in projecting sustained shock technology can enable the wearer to relax more thoroughly. Unique breathable outsole structure, with large areas of mesh on the upper war reached a new height on the boot breathability. According to foot the side different, and unique design of the outsole structure, you also have the comfort of these shoes has doubled.
 [2014-10-07 23:22 UTC] stas@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=e66a5ce56fc9be74096e0d0452a1172c8130752c
Log: Fixed Bug #63103 (ext\curl\tests\bug62839.phpt broken)
 [2014-10-07 23:23 UTC] stas@php.net
Automatic comment on behalf of pierrick
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=9cf0139460c7531ebe8fdd523ba6cf7067a7f282
Log: Fixed bug #62839
 [2014-10-07 23:33 UTC] stas@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=e66a5ce56fc9be74096e0d0452a1172c8130752c
Log: Fixed Bug #63103 (ext\curl\tests\bug62839.phpt broken)
 [2014-10-07 23:34 UTC] stas@php.net
Automatic comment on behalf of pierrick
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=9cf0139460c7531ebe8fdd523ba6cf7067a7f282
Log: Fixed bug #62839
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 07:01:27 2024 UTC