From: Arnaud Le Blanc Date: Thu, 11 Sep 2008 15:22:17 +0000 (+0000) Subject: Fixed #46051 (SplFileInfo::openFile - memory overlap) X-Git-Tag: BEFORE_HEAD_NS_CHANGE~429 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f327994df3e8e36005f2fc09f44880bdd8e14676;p=php Fixed #46051 (SplFileInfo::openFile - memory overlap) --- diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index e61098b192..40f196266a 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 0000000000..49a58247c0 --- /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"