php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46647 SplFileObject->fgetcsv() segfaults when passing 0 as argument
Submitted: 2008-11-22 18:04 UTC Modified: 2008-12-20 00:53 UTC
From: felipensp at gmail dot com Assigned: colder (profile)
Status: Closed Package: SPL related
PHP Version: 6CVS-2008-11-22 (CVS) OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: felipensp at gmail dot com
New email:
PHP Version: OS:

 

 [2008-11-22 18:04 UTC] felipensp at gmail dot com
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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-20 00:53 UTC] colder@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-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 20:01:32 2025 UTC