php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38891 curlwrappers fail
Submitted: 2006-09-20 07:05 UTC Modified: 2006-09-25 16:02 UTC
From: hannes dot magnusson at gmail dot com Assigned: iliaa (profile)
Status: Closed Package: cURL related
PHP Version: 5CVS-2006-09-20 (CVS) OS: FreeBSD
Private report: No CVE-ID: None
 [2006-09-20 07:05 UTC] hannes dot magnusson at gmail dot com
Description:
------------
The following script fails --with-curlwrappers, works fine 
without them.

Reproduce code:
---------------
php -r 'get_headers("http://example.com"); get_headers("http://example.com");'


Actual result:
--------------
5.1-cvs:
FATAL:  emalloc():  Unable to allocate 1515870811 bytes
Segmentation fault: 11 (core dumped)

#0  0x28c42a17 in kill () from /lib/libc.so.6
#1  0x08257fd9 in _emalloc (size=1515870811, 
__zend_filename=0x8356700 "/usr/src/php/5.1/Zend/zend_API.c", 
__zend_lineno=1149, __zend_orig_filename=0x0,
    __zend_orig_lineno=0) 
at /usr/src/php/5.1/Zend/zend_alloc.c:206
#2  0x082583ed in _estrndup (s=0x853d824 "\b", 
length=1515870810, 
__zend_filename=0x8356700 "/usr/src/php/5.1/Zend/zend_API.c", 
__zend_lineno=1149,
    __zend_orig_filename=0x0, __zend_orig_lineno=0) 
at /usr/src/php/5.1/Zend/zend_alloc.c:440
#3  0x082712c8 in add_next_index_stringl (arg=0x0, 
str=0x853d824 "\b", length=1515870810, duplicate=1) 
at /usr/src/php/5.1/Zend/zend_API.c:1149
#4  0x082018de in zif_get_headers (ht=1, 
return_value=0x853c7a4, return_value_ptr=0x0, 
this_ptr=0x0, return_value_used=0)
    at /usr/src/php/5.1/ext/standard/url.c:683
#5  0x08288b7d in zend_do_fcall_common_helper_SPEC 
(execute_data=0xbfbfe610) at zend_vm_execute.h:200
#6  0x082884e9 in execute (op_array=0x853f524) at 
zend_vm_execute.h:92
#7  0x082636b3 in zend_eval_string (str=0x853f524 "\004", 
retval_ptr=0x0, string_name=0x835f273 "Command line code")
    at /usr/src/php/5.1/Zend/zend_execute_API.c:1116
#8  0x0826384c in zend_eval_string_ex 
(str=0xbfbfea80 "get_headers(\"http://example.com\"); 
get_headers(\"http://example.com\");", retval_ptr=0x0,
    string_name=0x835f273 "Command line code", 
handle_exceptions=1) 
at /usr/src/php/5.1/Zend/zend_execute_API.c:1150
#9  0x082f49b4 in main (argc=3, argv=0xbfbfe958) 
at /usr/src/php/5.1/sapi/cli/php_cli.c:1182


5.2-cvs:
PHP Fatal error:  Out of memory (allocated 262144) 
at /usr/src/php/5.2/Zend/zend_API.c:1205 (tried to 
allocate 1515870811 bytes) in Command line code on line 1
/usr/src/php/5.2/main/streams/streams.c(386) : Stream of 
type 'MEMORY' 0x84f0aa4 (path:(null)) was not closed
/usr/src/php/5.2/main/streams/streams.c(386) : Stream of 
type 'cURL' 0x84f07e4 (path:http://example.com) was not 
closed

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-23 12:00 UTC] tony2001@php.net
The segfault is fixed for now, but the driver returns wrong data, so get_headers() still doesn't work with curlwrappers.
 [2006-09-25 12:15 UTC] tony2001@php.net
Ilia, please take a look at it.
Currently I don't think it's possible to make it work with curl wrappers becasue of 2 reasons:
1) curl wrapper treats the wrapperdata in totally different way;
2) curl wrapper does not really perform the request when opening the stream; the request is performed when _reading_ the data (which is somewhat expected, though..).
 [2006-09-25 16:02 UTC] iliaa@php.net
This bug has been fixed in CVS.

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/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 07 03:01:26 2024 UTC