Bug #54798 [Asn->Csd]: Segfault when CURLOPT_STDERR file pointer is closed before calling curl_exec
Edit report at https://bugs.php.net/bug.php?id=54798&edit=1
ID: 54798
Updated by: bjori@php.net
Reported by: shein@php.net
Summary: Segfault when CURLOPT_STDERR file pointer is closed
before calling curl_exec
-Status: Assigned
+Status: Closed
Type: Bug
Package: cURL related
Operating System: Ubuntu Linux 11.04 x86
PHP Version: trunk-SVN-2011-05-17 (SVN)
Assigned To: bjori
Block user comment: N
Private report: N
New Comment:
http://svn.php.net/viewvc?view=revision&revision=316511
Previous Comments:
------------------------------------------------------------------------
[2011-09-09 11:36:50] shein@php.net
The fix was wrong, reopening bug, see discussion over here:
http://news.php.net/php.cvs/66389 and here http://news.php.net/php.cvs/66399
------------------------------------------------------------------------
[2011-09-08 14:37:37] bjori@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.
------------------------------------------------------------------------
[2011-09-08 14:37:05] bjori@php.net
Automatic comment from SVN on behalf of bjori
Revision: http://svn.php.net/viewvc/?view=revision&revision=316417
Log: Fixed bug#54798 Segfault when CURLOPT_STDERR file pointer is closed before calling curl_exec
------------------------------------------------------------------------
[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 https://bugs.php.net/bug.php?id=54798&edit=1
Thread (5 messages)