From:             kfou at free dot fr
Operating system: Windows and Linux
PHP version:      5.2.4RC2
PHP Bug Type:     Reproducible crash
Bug description:  Crash when using getRealPath with DirectoryIterator

Description:
------------
Calling getRealPath on an DirectoryIterator make PHP crash, 
getPath works fine.


The problem also happens with php 5.2.3

Reproduce code:
---------------
<?php
$it = new DirectoryIterator("/tmp");

foreach ($it as $e)
{
  $path = $e->getRealPath();
}
?>

Actual result:
--------------
(gdb) run test.php
Starting program: /home/wwwdev/php/bin/php test.php
Failed to read a valid object file image from memory.

Program received signal SIGSEGV, Segmentation fault.
tsrm_realpath (path=0x0, real_path=0xbfb0f20c "6É\025\b\001")
    at /home/wwwdev/php5.2-200708201630/TSRM/tsrm_virtual_cwd.c:1266
1266            if (!*path) {
(gdb) bt
#0  tsrm_realpath (path=0x0, real_path=0xbfb0f20c "6É\025\b\001")
    at /home/wwwdev/php5.2-200708201630/TSRM/tsrm_virtual_cwd.c:1266
#1  0x080a1c8c in zim_spl_SplFileInfo_getRealPath (ht=0,
return_value=0xb7d0519c,
    return_value_ptr=0x0, this_ptr=0xb7d04598, return_value_used=1)
    at /home/wwwdev/php5.2-200708201630/ext/spl/spl_directory.c:861
#2  0x08175cc2 in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfb103e0)
    at /home/wwwdev/php5.2-200708201630/Zend/zend_vm_execute.h:202
#3  0x08174b58 in execute (op_array=0xb7d04a40)
    at /home/wwwdev/php5.2-200708201630/Zend/zend_vm_execute.h:94
#4  0x081575f4 in zend_execute_scripts (type=8, retval=<value optimized
out>,
    file_count=3) at /home/wwwdev/php5.2-200708201630/Zend/zend.c:1134
#5  0x08117c00 in php_execute_script (primary_file=0xbfb1279c)
    at /home/wwwdev/php5.2-200708201630/main/main.c:1982
#6  0x081d1674 in main (argc=2, argv=0xbfb128a4)
    at /home/wwwdev/php5.2-200708201630/sapi/cli/php_cli.c:1140


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

Reply via email to