mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix GH-17500: Segfault with requesting nodeName on nameless doctype
Closes GH-17344.
This commit is contained in:
4
NEWS
4
NEWS
@@ -13,6 +13,10 @@ PHP NEWS
|
||||
nielsdos)
|
||||
. Fixed potential OOB when checking for trailing spaces on Windows. (cmb)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug GH-17500 (Segfault with requesting nodeName on nameless doctype).
|
||||
(nielsdos)
|
||||
|
||||
- Enchant:
|
||||
. Fix crashes in enchant when passing null bytes. (nielsdos)
|
||||
|
||||
|
||||
@@ -98,11 +98,17 @@ int dom_node_node_name_read(dom_object *obj, zval *retval)
|
||||
}
|
||||
case XML_DOCUMENT_TYPE_NODE:
|
||||
case XML_DTD_NODE:
|
||||
if (nodep->name) {
|
||||
ZVAL_STRING(retval, (const char *) nodep->name);
|
||||
} else {
|
||||
ZVAL_EMPTY_STRING(retval);
|
||||
}
|
||||
break;
|
||||
case XML_PI_NODE:
|
||||
case XML_ENTITY_DECL:
|
||||
case XML_ENTITY_REF_NODE:
|
||||
case XML_NOTATION_NODE:
|
||||
ZVAL_STRING(retval, (char *) nodep->name);
|
||||
ZVAL_STRING(retval, (const char *) nodep->name);
|
||||
break;
|
||||
case XML_CDATA_SECTION_NODE:
|
||||
ZVAL_STRING(retval, "#cdata-section");
|
||||
|
||||
14
ext/dom/tests/gh17500.phpt
Normal file
14
ext/dom/tests/gh17500.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
GH-17500 (Segfault with requesting nodeName on nameless doctype)
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadHTML("<!DOCTYPE>", LIBXML_NOERROR);
|
||||
var_dump($doc->doctype->nodeName);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(0) ""
|
||||
Reference in New Issue
Block a user