#32327 [NEW]: Inherited DirectoryIterator and permissions failure causes segfault
| From: | tm at iprog dot com | Date: | Tue, 15 Mar 2005 21:38:09 +0000 |
| Subject: | #32327 [NEW]: Inherited DirectoryIterator and permissions failure causes segfault | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-75384@lists.php.net to get a copy of this message | ||
From: tm at iprog dot com
Operating system: os x 10.3 / linux 2.4
PHP version: 5.0.3
PHP Bug Type: Reproducible crash
Bug description: Inherited DirectoryIterator and permissions failure causes segfault
Description:
------------
Tested on PHP 5.0.3 on Mac OS X 10.3.8 and also PHP 5.0.2 on Linux 2.4.22.
Reproducible from inside Apache and also on command line via PHP-CLI.
To reproduce, do the following:
% mkdir breakme
% chmod -r breakme
% php crash1.php
Because of the lack of permissions on directory 'breakme', the script will
segfault. If breakme has read perms, the script executes fine.
Additionally, if line 14 of the script is changed to:
$rdir = new resourcedir('./breakme');
then an exception is generated. However, for some reason it is not being
generated with the example as provided.
Reproduce code:
---------------
<?php
class resourcedir extends DirectoryIterator {
public function __construct($newdir) {
print "__c:$newdir\n";
parent::__construct($newdir);
}
public function current() {
parent::current();
if ($this->isDir())
return new resourcedir($this->getpathname());
return null;
}
}
$rdir = new resourcedir('.');
foreach ($rdir as $res)
if (is_object($res))
print 'dir:'.$res->getPathname()."\n";
?>
Expected result:
----------------
A basic directory listing w/o a seg fault.
Actual result:
--------------
The directory listing up until it hits the restricted directory and then a
seg fault.
From OS X's crash log (when running via apache):
Date/Time: 2005-03-15 14:21:52 -0700
OS Version: 10.3.8 (Build 7U16)
Report Version: 2
Command: httpd
Path: /usr/sbin/httpd
Version: ??? (???)
PID: 29678
Thread: 0
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000008
Thread 0 Crashed:
0 libphp5.so 0x02e0c664 zend_fe_fetch_handler + 0x5c8
1 libphp5.so 0x02e03178 execute + 0x1f0
2 libphp5.so 0x02dd0d58 zend_execute_scripts + 0x140
3 libphp5.so 0x02d73d68 php_execute_script + 0x380
4 libphp5.so 0x02e134d8 apache_php_module_main + 0xd4
5 libphp5.so 0x02e14818 send_php + 0x380
6 libphp5.so 0x02e14898 send_parsed_php + 0x28
7 httpd 0x0000dbbc ap_invoke_handler + 0xe8
8 httpd 0x00017c6c process_request_internal + 0x280
9 httpd 0x00017cec ap_process_request + 0x48
10 httpd 0x00006a10 child_main + 0x69c
11 httpd 0x00006c74 make_child + 0x138
12 httpd 0x00006fa4 perform_idle_server_maintenance + 0x23c
13 httpd 0x00007580 standalone_main + 0x3c4
14 httpd 0x00007c24 main + 0x41c
15 httpd 0x000027a8 _start + 0x188
16 httpd 0x0000261c start + 0x30
--
Edit bug report at http://bugs.php.net/?id=32327&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32327&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32327&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32327&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32327&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32327&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32327&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32327&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32327&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32327&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32327&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32327&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32327&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32327&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32327&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32327&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32327&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32327&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32327&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32327&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32327&r=mysqlcfg