Edit report at http://bugs.php.net/bug.php?id=54798&edit=1

 ID:                 54798
 Updated by:         fel...@php.net
 Reported by:        sh...@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] sh...@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

Reply via email to