summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-02-13 15:15:45 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2020-02-13 15:16:09 +0100
commitbf8c6519fb7f13462cf902b0d17a02c50f6851c7 (patch)
tree50729b80edebaae39155e8da999b3f63e812bc4b
parent61e76927b4671c0396b51dac06ac54f643e32524 (diff)
parent8ebadd1128bede1764658a8f70e2ebae14dbc7b0 (diff)
downloadphp-git-bf8c6519fb7f13462cf902b0d17a02c50f6851c7.tar.gz
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #77569: Write Acess Violation in DomImplementation
-rw-r--r--NEWS4
-rw-r--r--ext/dom/document.c2
-rw-r--r--ext/dom/tests/bug77569.phpt14
3 files changed, 19 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index d8467ac018..9c2d4a8e5e 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,10 @@ PHP NEWS
- CURL:
. Fixed bug #79019 (Copied cURL handles upload empty file). (cmb)
+- DOM:
+ . Fixed bug #77569: (Write Acess Violation in DomImplementation). (Nikita,
+ cmb)
+
- PCRE:
. Fixed bug #79188 (Memory corruption in preg_replace/preg_replace_callback
and unicode). (Nikita)
diff --git a/ext/dom/document.c b/ext/dom/document.c
index df1e7a8dfb..b10bed72dd 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -342,7 +342,7 @@ int dom_document_encoding_write(dom_object *obj, zval *newval)
return FAILURE;
}
- handler = xmlFindCharEncodingHandler(Z_STRVAL_P(newval));
+ handler = xmlFindCharEncodingHandler(ZSTR_VAL(str));
if (handler != NULL) {
xmlCharEncCloseFunc(handler);
diff --git a/ext/dom/tests/bug77569.phpt b/ext/dom/tests/bug77569.phpt
new file mode 100644
index 0000000000..f0f3566708
--- /dev/null
+++ b/ext/dom/tests/bug77569.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #77569 (Write Acess Violation in DomImplementation)
+--SKIPIF--
+<?php
+if (!extension_loaded('dom')) die('skip dom extension not available');
+?>
+--FILE--
+<?php
+$imp = new DOMImplementation;
+$dom = $imp->createDocument("", "");
+$dom->encoding = null;
+?>
+--EXPECTF--
+Warning: main(): Invalid Document Encoding in %s on line %d