summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-02-13 15:14:45 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2020-02-13 15:15:05 +0100
commit8ebadd1128bede1764658a8f70e2ebae14dbc7b0 (patch)
tree5aca4bd1f0b7f1e8e1faa46f869e73eb6763df45
parent7b464ce6f3feb94dc5b897e4f8792a39e07710b6 (diff)
parentcec8b24c848bab8562c82422f3692c193f0afcdb (diff)
downloadphp-git-8ebadd1128bede1764658a8f70e2ebae14dbc7b0.tar.gz
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: 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 af20e3db3d..0777b34d55 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,10 @@ PHP NEWS
x86). (cmb)
. Fixed bug #79248 (Traversing empty VT_ARRAY throws com_exception). (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 9f9ce5e2f8..22bb90d5d8 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -339,7 +339,7 @@ int dom_document_encoding_write(dom_object *obj, zval *newval)
str = zval_get_string(newval);
- 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