summaryrefslogtreecommitdiff
path: root/ext/libxml/libxml.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2019-12-25 16:29:30 +0800
committerXinchen Hui <laruence@gmail.com>2019-12-25 16:29:30 +0800
commitce4d80a85a1355dbfbc0f1b1dc005e54bfc28130 (patch)
treeab7d0d97ca8879d6c19a381cbaece7bf4781b67c /ext/libxml/libxml.c
parent66a591aebe9c76d6703435426131c2494c3b25d0 (diff)
parente36daa6927c05d2e687bb77495ef206cde118b33 (diff)
downloadphp-git-ce4d80a85a1355dbfbc0f1b1dc005e54bfc28130.tar.gz
Merge branch 'PHP-7.4'
* PHP-7.4: Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter).
Diffstat (limited to 'ext/libxml/libxml.c')
-rw-r--r--ext/libxml/libxml.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index 9c6a51f5f8..e330022eeb 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -327,6 +327,10 @@ static void *php_libxml_streams_IO_open_wrapper(const char *filename, const char
context = php_stream_context_from_zval(Z_ISUNDEF(LIBXML(stream_context))? NULL : &LIBXML(stream_context), 0);
ret_val = php_stream_open_wrapper_ex(path_to_open, (char *)mode, REPORT_ERRORS, NULL, context);
+ if (ret_val) {
+ /* Prevent from closing this by fclose() */
+ ((php_stream*)ret_val)->flags |= PHP_STREAM_FLAG_NO_FCLOSE;
+ }
if (isescaped) {
xmlFree(resolved_path);
}