ID: 48203 Comment by: mark at dynom dot nl Reported By: php-bug at paulsohier dot nl Status: Verified Bug Type: cURL related Operating System: * PHP Version: 5.*, 6CVS (2009-05-09) New Comment:
I can reproduce it on cURL 7.19.4 on PHP 5.2.9, but only when not using the verbose option. When CURLOPT_VERBOSE is false, or not set at all, I get no segfaults. When true, it segfaults. Previous Comments: ------------------------------------------------------------------------ [2009-05-09 20:58:11] php-bug at paulsohier dot nl Its also related somehow to the url thats used to fetch, as when you try it with example.org the script works okay. ------------------------------------------------------------------------ [2009-05-09 20:51:47] j...@php.net Verified with all branches using cURL 7.15.5 ------------------------------------------------------------------------ [2009-05-09 20:51:04] j...@php.net <?php $url = 'www.hosthuis.nl'; $ch = curl_init(); $handle = fopen('/tmp/tt.tmp', 'w'); // $handle = STDERR; // This works curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_STDERR, $handle); curl_setopt($ch, CURLOPT_URL, $url); curl_exec($ch); ?> ------------------------------------------------------------------------ [2009-05-09 13:44:05] php-bug at paulsohier dot nl Description: ------------ Discovered during testfest in Utrecht and asked by Piere to report. When calling curl with a certian url and without closing the curl stream curl will segfault. Curl version: p...@dwerg:~/php/php5.3-200905090830$ curl-config --version libcurl 7.18.2 Used host where it segfault: www.hosthuis.nl Used host where it NOT segfault: www.example.org Reproduce code: --------------- <?php $host = 'www.hosthuis.nl'; $temp_file = tempnam(sys_get_temp_dir(), ''); $handle = fopen($temp_file, 'w'); $url = "{$host}/"; $ch = curl_init(); ob_start(); // start output buffering curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_STDERR, $handle); curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use curl_exec($ch); fclose($handle); ?> Expected result: ---------------- The contents of the site Actual result: -------------- The contents of the site and a segfault from run test (Bit different script) *** glibc detected *** /home/paul/php/php5.3-200905090830/sapi/cli/php: free(): invalid pointer: 0x4001f000 *** ======= Backtrace: ========= /lib/i686/cmov/libc.so.6[0x40624624] /lib/i686/cmov/libc.so.6(cfree+0x96)[0x40626826] /lib/i686/cmov/libc.so.6(_IO_free_backup_area+0x34)[0x40622b54] /lib/i686/cmov/libc.so.6(_IO_file_overflow+0x1c2)[0x40620962] /lib/i686/cmov/libc.so.6(_IO_file_xsputn+0x65)[0x4061f9d5] /lib/i686/cmov/libc.so.6(fwrite+0x10a)[0x4061586a] /usr/lib/libcurl.so.4[0x40363428] /usr/lib/libcurl.so.4[0x40363547] /usr/lib/libcurl.so.4[0x403640d9] /usr/lib/libcurl.so.4[0x4036a81a] /usr/lib/libcurl.so.4[0x4036abdf] /usr/lib/libcurl.so.4[0x4036ef77] /usr/lib/libcurl.so.4(curl_easy_cleanup+0x21)[0x4037aec1] /home/paul/php/php5.3-200905090830/sapi/cli/php[0x80f288b] /home/paul/php/php5.3-200905090830/sapi/cli/php[0x82f9a22] /home/paul/php/php5.3-200905090830/sapi/cli/php(zend_hash_del_key_or_index+0xe2)[0x82f8a42] /home/paul/php/php5.3-200905090830/sapi/cli/php(_zend_list_delete+0x70)[0x82f9c70] /home/paul/php/php5.3-200905090830/sapi/cli/php(_zval_ptr_dtor+0x3d)[0x82dfd6d] /home/paul/php/php5.3-200905090830/sapi/cli/php[0x82f65e2] /home/paul/php/php5.3-200905090830/sapi/cli/php(zend_hash_graceful_reverse_destroy+0x1f)[0x82f686f] /home/paul/php/php5.3-200905090830/sapi/cli/php[0x82e20e8] /home/paul/php/php5.3-200905090830/sapi/cli/php[0x82eb843] /home/paul/php/php5.3-200905090830/sapi/cli/php(php_request_shutdown+0x15f)[0x829b5df] /home/paul/php/php5.3-200905090830/sapi/cli/php[0x836b079] /lib/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0x405cc455] /home/paul/php/php5.3-200905090830/sapi/cli/php(realloc+0x95)[0x8065241] ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48203&edit=1