php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37502 glob(*) segfaults with 511,145 files
Submitted: 2006-05-18 15:32 UTC Modified: 2006-05-18 18:30 UTC
From: david at eder dot us Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.1.4 OS: Fedora Core 5
Private report: No CVE-ID: None
 [2006-05-18 15:32 UTC] david at eder dot us
Description:
------------
When glob is called on a directory that has 511,145 files it segfaults.

Reproduce code:
---------------
<?php glob('*'); ?>

Expected result:
----------------
work or fail, but not crash.

Actual result:
--------------
GNU gdb Red Hat Linux (6.3.0.0-1.84rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run test.php
Starting program: /tmp/php-5.1.4/sapi/cli/php test.php
Reading symbols from shared object read from target memory...done.
Loaded system supplied DSO at 0xbcb000
[Thread debugging using libthread_db enabled]
[New Thread -1209100608 (LWP 28065)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1209100608 (LWP 28065)]
0x00c7fa4c in internal_fnwmatch () from /lib/libc.so.6
(gdb) bt
#0  0x00c7fa4c in internal_fnwmatch () from /lib/libc.so.6
#1  0x00c814ef in fnmatch@GLIBC_2.0 () from /lib/libc.so.6
#2  0x00c7917b in glob_in_dir () from /lib/libc.so.6
#3  0x00c79fdc in glob () from /lib/libc.so.6
#4  0x0814ceb4 in zif_glob (ht=1, return_value=0x98ab1e4, return_value_ptr=0x0, this_ptr=0x0, return_value_used=0)
    at /tmp/php-5.1.4/ext/standard/dir.c:398
#5  0x081ec289 in zend_do_fcall_common_helper_SPEC (execute_data=0xbfb026e0) at /tmp/php-5.1.4/Zend/zend_vm_execute.h:200
#6  0x081eba2d in execute (op_array=0x98aba44) at /tmp/php-5.1.4/Zend/zend_vm_execute.h:92
#7  0x081d5a5b in zend_execute_scripts (type=8, retval=Variable "retval" is not available.
) at /tmp/php-5.1.4/Zend/zend.c:1109
#8  0x081a1bb6 in php_execute_script (primary_file=0xbfb04b04) at /tmp/php-5.1.4/main/main.c:1732
#9  0x0824e8dd in main (argc=2, argv=0xbfb04c44) at /tmp/php-5.1.4/sapi/cli/php_cli.c:1092


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-18 18:30 UTC] tony2001@php.net
The backtrace clearly shows that the problem is actually in glibc.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 21:01:33 2024 UTC