From:             felipensp at gmail dot com
Operating system: 
PHP version:      6CVS-2008-11-22 (CVS)
PHP Bug Type:     SPL related
Bug description:  SplFileObject->fgetcsv() segfaults when passing 0 as argument

Description:
------------
See below.

Reproduce code:
---------------
<?php
        
$x = new splfileobject(__FILE__);
$x->fgetcsv(0);


Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb65c56e0 (LWP 23504)]
0x083f49cc in php_fgetcsv_ex (stream=0xa54d3b4, delimiter=0xbf9f6228
"0b\237&#65533;&#65533;&#65533;Q\b&#65533;&#65533;(\n\024",
delimiter_len=1, enclosure=0xbf9f6224 "\"", enclosure_len=1, 
    escape=0x6 <Address 0x6 out of bounds>, escape_len=1, buffer=0xa54d7a0
"<?php\n", buffer_len=6, return_value=0xa54d7d8, tsrm_ls=0xa28d070)
    at /home/felipe/dev/php6/ext/standard/file.c:2381
2381                                    if ((PHP_FGETCSV_BIN_CHECK(p, e, 
escape, escape_len) && escape !=
enclosure) ||
(gdb) bt
#0  0x083f49cc in php_fgetcsv_ex (stream=0xa54d3b4, delimiter=0xbf9f6228
"0b\237&#65533;&#65533;&#65533;Q\b&#65533;&#65533;(\n\024",
delimiter_len=1, enclosure=0xbf9f6224 "\"", enclosure_len=1, 
    escape=0x6 <Address 0x6 out of bounds>, escape_len=1, buffer=0xa54d7a0
"<?php\n", buffer_len=6, return_value=0xa54d7d8, tsrm_ls=0xa28d070)
    at /home/felipe/dev/php6/ext/standard/file.c:2381
#1  0x083f467f in php_fgetcsv (stream=0xa54d3b4, delimiter=48 '0',
enclosure=34 '"', escape=0 '\0', buf_len=6, buf=0xa54d7a0 "<?php\n",
return_value=0xa54d7d8, 
    tsrm_ls=0xa28d070) at /home/felipe/dev/php6/ext/standard/file.c:2311
#2  0x082c1a1d in spl_filesystem_file_read_csv (intern=0xa54e2c0,
delimiter=48 '0', enclosure=34 '"', escape=0 '\0', return_value=0xa54c08c,
tsrm_ls=0xa28d070)
    at /home/felipe/dev/php6/ext/spl/spl_directory.c:2002
#3  0x082c2ce8 in zim_spl_SplFileObject_fgetcsv (ht=1,
return_value=0xa54c08c, return_value_ptr=0xa57fb74, this_ptr=0xa54c29c,
return_value_used=0, 
    tsrm_ls=0xa28d070) at
/home/felipe/dev/php6/ext/spl/spl_directory.c:2397


-- 
Edit bug report at http://bugs.php.net/?id=46647&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=46647&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=46647&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=46647&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=46647&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=46647&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=46647&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=46647&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=46647&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=46647&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=46647&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=46647&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=46647&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=46647&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=46647&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=46647&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=46647&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=46647&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=46647&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=46647&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=46647&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=46647&r=mysqlcfg

Reply via email to