Bug #54798 [Opn->Asn]: Segfault when CURLOPT_STDERR file pointer is closed before calling curl_exec
| From: | felipe@php.net | Date: | Sun, 12 Jun 2011 00:14:20 +0000 |
| Subject: | Bug #54798 [Opn->Asn]: Segfault when CURLOPT_STDERR file pointer is closed before calling curl_exec | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-161331@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54798&edit=1
ID: 54798
Updated by: felipe@php.net
Reported by: shein@php.net
Summary: Segfault when CURLOPT_STDERR file pointer is closed
before calling curl_exec
-Status: Open
+Status: Assigned
Type: Bug
Package: cURL related
Operating System: Ubuntu Linux 11.04 x86
PHP Version: trunk-SVN-2011-05-17 (SVN)
-Assigned To:
+Assigned To: iliaa
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2011-05-17 16:25:32] shein@php.net
Description:
------------
Related to http://bugs.php.net/bug.php?id=48203
Curl crashes when CURLOPT_STDERR file pointer is closed before calling
curl_exec(), i.e.
$fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w');
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_STDERR, $fp);
curl_setopt($ch, CURLOPT_URL, getenv("PHP_CURL_HTTP_REMOTE_SERVER"));
fclose($fp); // <-- premature close of $fp caused a crash!
curl_exec($ch); // segfault
Error is reproduced on latest svn php5.3, php5.4 and trunk
Fix is also attached here.
Test script:
---------------
Full test script is available here: http://svn.php.net/viewvc/php/php-src/trunk/ext/curl/tests/bug48203.phpt?view=markup
Expected result:
----------------
No segfault, see test script
Actual result:
--------------
Segfault
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54798&edit=1