From 9b04ebc3c83fc1c7eba2bf1557990e33fd44908c Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Thu, 11 Sep 2008 15:24:12 +0000 Subject: [PATCH] MFH: Fixed #46051 (SplFileInfo::openFile - memory overlap) --- NEWS | 1 + ext/spl/spl_directory.c | 1 + ext/spl/tests/bug46051.phpt | 14 ++++++++++++++ 3 files changed, 16 insertions(+) create mode 100644 ext/spl/tests/bug46051.phpt diff --git a/NEWS b/NEWS index 2f18c3cd38..0a38dabcdb 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,7 @@ PHP NEWS (Scott) - Fixed a crash on invalid method in ReflectionParameter constructor. (Christian Seiler) +- Fixed bug #46051 (SplFileInfo::openFile - memory overlap). (Arnaud) - Fixed bug #46047 (SimpleXML converts empty nodes into object with nested array). (Rob) - Fixed bug #46031 (Segfault in AppendIterator::next). (Arnaud) diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index fbedf49666..9e8a161800 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -426,6 +426,7 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil &use_include_path, &intern->u.file.zcontext) == FAILURE) { php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); intern->u.file.open_mode = NULL; + intern->file_name = NULL; zval_dtor(return_value); Z_TYPE_P(return_value) = IS_NULL; return NULL; diff --git a/ext/spl/tests/bug46051.phpt b/ext/spl/tests/bug46051.phpt new file mode 100644 index 0000000000..e993951ffa --- /dev/null +++ b/ext/spl/tests/bug46051.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #46051 (SplFileInfo::openFile - memory overlap) +--FILE-- +openFile(NULL, NULL, NULL); +} catch (Exception $e) { } + +var_dump($x->getPathName()); +--EXPECTF-- +string(%d) "%sbug46051.php" -- 2.50.1