From f327994df3e8e36005f2fc09f44880bdd8e14676 Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Thu, 11 Sep 2008 15:22:17 +0000 Subject: [PATCH] Fixed #46051 (SplFileInfo::openFile - memory overlap) --- ext/spl/spl_directory.c | 1 + ext/spl/tests/bug46051.phpt | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 ext/spl/tests/bug46051.phpt diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index e61098b192d..40f196266a3 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -533,6 +533,7 @@ static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_fil &use_include_path, &intern->u.file.zcontext) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); intern->u.file.open_mode = NULL; + intern->file_name.v = 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 00000000000..49a58247c05 --- /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-- +%unicode|string%(%d) "%sbug46051.php"