From:             
Operating system: Linux x86-64
PHP version:      5.3SVN-2011-03-17 (SVN)
Package:          Reproducible crash
Bug Type:         Bug
Bug description:Crash in spl_filesystem_object_get_path

Description:
------------
The attached code crashes on PHP5.3 SVN. Since this is pretty sure only a
null-pointer deref, reporting this as public (non-security related).

Test script:
---------------
<?php

   $targetDir =
chr(0).DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename');

   $dir = new DirectoryIterator($targetDir.DIRECTORY_SEPARATOR);

   while(!$dir->isFile()) {

   }

?>

Actual result:
--------------
==2043== Invalid read of size 8

==2043==    at 0x6586DB: spl_filesystem_object_get_path
(spl_directory.c:168)

==2043==    by 0x6587B0: spl_filesystem_object_get_file_name
(spl_directory.c:190)

==2043==    by 0x65BF85: zim_spl_SplFileInfo_isFile (spl_directory.c:1163)

==2043==    by 0x7ED61F: zend_do_fcall_common_helper_SPEC
(zend_vm_execute.h:638)

==2043==    by 0x7EE50E: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER
(zend_vm_execute.h:748)

==2043==    by 0x7EC0F3: execute (zend_vm_execute.h:410)

==2043==    by 0x7B0314: zend_execute_scripts (zend.c:1212)

==2043==    by 0x726A37: php_execute_script (main.c:2344)

==2043==    by 0x8EC455: main (php_cli.c:1136)

==2043==  Address 0x0 is not stack'd, malloc'd or (recently) free'd

==2043== 

==2043== 

==2043== Process terminating with default action of signal 11 (SIGSEGV)

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

Reply via email to