php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13921 reproducible crash when curl_exec()ing with CURL_WRITEHEADER set
Submitted: 2001-11-04 11:26 UTC Modified: 2001-11-04 19:21 UTC
From: mitja at doticni dot net Assigned:
Status: Closed Package: cURL related
PHP Version: 4.0.6 OS: Linux 2.4.3
Private report: No CVE-ID: None
 [2001-11-04 11:26 UTC] mitja at doticni dot net
curl_exec crashes, when there's a CURL_WRITEHEADER set. it didn't use to when using php 4.0.4pl1 and curl 7.7.2. In PHP 4.0.6 it crashes with both curl 7.8.1 and 7.9.1.

my config line:

./configure -enable-debug --with-openssl --enable-bcmath --enable-calendar --with-curl --with-dom=/usr/local --enable-ftp --enable-gd-imgstrttf --with-gd --with-jpeg-dir=/usr/local --with-mysql=/usr/local --enable-sockets --with-swf --with-zlib --enable-inline-optimization --enable-track-vars --with-ttf --with-freetype

(it also crashes when used as apache 1.3.22 module)


script:

<?

$host="www.php.net";
$uri="/search.php";

$conn=curl_init("http://".$host.$uri);

$file1=fopen("/tmp/headers.txt", "w");
$file2=fopen("/tmp/content.txt", "w");

// if you comment the next line, everything is ok (but then you have no headers :(
curl_setopt($conn, CURLOPT_WRITEHEADER, $file1);
curl_setopt($conn, CURLOPT_FILE, $file2);

curl_exec($conn);
curl_close($conn);

fclose($file1);
fclose($file2);

?>

backtrace:

#0  0x8077a32 in curl_write (data=0x81f4248 "HTTP/1.0 200 OK\r\n", size=1, nmemb=17, ctx=0x81ef4f8)
    at curl.c:257
#1  0x4013e63e in Curl_client_write (data=0x40378008, type=2, ptr=0x81f4248 "HTTP/1.0 200 OK\r\n", len=17)
    at sendf.c:251
#2  0x4014ac74 in Transfer (c_conn=0x81ef830) at transfer.c:661
#3  0x4014b7c1 in Curl_perform (data=0x40378008) at transfer.c:956
#4  0x4014baf0 in curl_easy_perform (curl=0x40378008) at easy.c:233
#5  0x80791c7 in php_if_curl_exec (ht=1, return_value=0x81f4034, this_ptr=0x0, return_value_used=0)
    at curl.c:772
#6  0x8118888 in execute (op_array=0x81ef32c) at ./zend_execute.c:1504
#7  0x80ed7bc in zend_execute_scripts (type=8, file_count=3) at zend.c:752
#8  0x806b4fd in php_execute_script (primary_file=0xbffff9d8) at main.c:1206
#9  0x8069abd in main (argc=2, argv=0xbffffa4c) at cgi_main.c:718
#10 0x4025e577 in __libc_start_main () from /lib/libc.so.6

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-04 19:21 UTC] sniper@php.net
This is fixed in CVS. Try the latest CVS snapshot from 
http://snaps.php.net/


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 02:01:29 2024 UTC