Skip to content

Commit 267ef3e

Browse files
committed
ext/spl: DirectoryIterator to support modern filesytems.
With filesystems with builtin large capacity such as ZFS, Btfrs, NTFS or even ext4 with large_dir feature enabled, an int to represent an entry index is falling short, thus risking overflows. A zend_long however should cover this need without increasing out internal data structure.
1 parent 1f648c3 commit 267ef3e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ext/spl/spl_directory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ static zend_object *spl_filesystem_object_clone(zend_object *old_object)
414414
spl_filesystem_dir_open(intern, source->path);
415415
/* read until we hit the position in which we were before */
416416
bool skip_dots = SPL_HAS_FLAG(source->flags, SPL_FILE_DIR_SKIPDOTS);
417-
int index;
417+
zend_long index;
418418
for (index = 0; index < source->u.dir.index; ++index) {
419419
do {
420420
spl_filesystem_dir_read(intern);

ext/spl/spl_directory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ struct _spl_filesystem_object {
6262
struct {
6363
php_stream *dirp;
6464
zend_string *sub_path;
65-
int index;
65+
zend_long index;
6666
zend_function *func_rewind;
6767
zend_function *func_next;
6868
zend_function *func_valid;

0 commit comments

Comments
 (0)