mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.0'
* PHP-8.0: Fix #66783: UAF when appending DOMDocument to element
This commit is contained in:
commit
e65f705ce3
2 changed files with 26 additions and 3 deletions
|
@ -1241,9 +1241,13 @@ int dom_hierarchy(xmlNodePtr parent, xmlNodePtr child)
|
|||
{
|
||||
xmlNodePtr nodep;
|
||||
|
||||
if (parent == NULL || child == NULL || child->doc != parent->doc) {
|
||||
return SUCCESS;
|
||||
}
|
||||
if (parent == NULL || child == NULL || child->doc != parent->doc) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (child->type == XML_DOCUMENT_NODE) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
nodep = parent;
|
||||
|
||||
|
|
19
ext/dom/tests/bug66783.phpt
Normal file
19
ext/dom/tests/bug66783.phpt
Normal file
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
Bug #66783 (UAF when appending DOMDocument to element)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('dom')) die('skip dom extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$doc = new DomDocument;
|
||||
$doc->loadXML('<root></root>');
|
||||
$e = $doc->createElement('e');
|
||||
try {
|
||||
$e->appendChild($doc);
|
||||
} catch (DOMException $ex) {
|
||||
echo $ex->getMessage(), PHP_EOL;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Hierarchy Request Error
|
Loading…
Add table
Add a link
Reference in a new issue