com php-src: Fixed bug #67359 (Segfault in recursiveDirectoryIterator): NEWS ext/spl/spl_directory.c ext/spl/spl_iterators.c
ext/spl/tests/bug67359.phpt

From: Date: Sun, 01 Jun 2014 11:41:01 +0000
Subject: com php-src: Fixed bug #67359 (Segfault in recursiveDirectoryIterator): NEWS ext/spl/spl_directory.c ext/spl/spl_iterators.c
ext/spl/tests/bug67359.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-78655@lists.php.net to get a copy of this message
Commit: 38be99b739c6ad55b01fe304a083e7a1e36c05ee Author: Xinchen Hui <laruence@php.net> Sun, 1 Jun 2014 19:41:01 +0800 Parents: b5d9983ff4373793621ee4b21d4964b30c5d21c8 Branches: PHP-5.4 PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=38be99b739c6ad55b01fe304a083e7a1e36c05ee Log: Fixed bug #67359 (Segfault in recursiveDirectoryIterator) Bugs: https://bugs.php.net/67359 Changed paths: M NEWS M ext/spl/spl_directory.c M ext/spl/spl_iterators.c A ext/spl/tests/bug67359.phpt Diff: diff --git a/NEWS b/NEWS index 354a796..04058b6 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ PHP NEWS (Adam) - SPL: + . Fixed bug #67359 (Segfault in recursiveDirectoryIterator). (Laruence) . Fixed bug #67360 (Missing element after ArrayObject::getIterator). (Adam) ?? ??? 2014, PHP 5.4.29 diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 0762db6..8cd352f 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -829,6 +829,7 @@ SPL_METHOD(DirectoryIterator, seek) zend_call_method_with_0_params(&this_ptr, Z_OBJCE_P(getThis()), &intern->u.dir.func_rewind, "rewind", &retval); if (retval) { zval_ptr_dtor(&retval); + retval = NULL; } } @@ -838,6 +839,7 @@ SPL_METHOD(DirectoryIterator, seek) if (retval) { valid = zend_is_true(retval); zval_ptr_dtor(&retval); + retval = NULL; } if (!valid) { break; diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index f3120b2..fd2e472 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -861,6 +861,8 @@ static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, char *object_ptr = zobj; function_handler = Z_OBJ_HT_P(*object_ptr)->get_method(object_ptr, method, method_len, key TSRMLS_CC); } + } else { + *object_ptr = zobj; } } return function_handler; diff --git a/ext/spl/tests/bug67359.phpt b/ext/spl/tests/bug67359.phpt new file mode 100644 index 0000000..e2e6113 --- /dev/null +++ b/ext/spl/tests/bug67359.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #67359 (Segfault in recursiveDirectoryIterator) +--FILE-- +<?php +try +{ + $rdi = new recursiveDirectoryIterator(dirname(__FILE__), FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS); + $it = new recursiveIteratorIterator( $rdi ); + $it->seek(1); + while( $it->valid()) + { + if( $it->isFile() ) + { + $it->current(); + } + + $it->next(); + } + + $it->current(); +} +catch(Exception $e) +{ +} +echo "okey" +?> +--EXPECTF-- +okey

« previous php.cvs (#78655) next »