1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix GH-15551: Segmentation fault (access null pointer) in ext/dom/xml_common.h

Closes GH-15556.
This commit is contained in:
Niels Dossche
2024-08-23 18:39:06 +02:00
parent 48a18e5be7
commit 9af574c26e
3 changed files with 22 additions and 2 deletions

4
NEWS
View File

@@ -8,6 +8,10 @@ PHP NEWS
. Fixed bug GH-15515 (Configure error grep illegal option q). (Peter Kokot)
. Fixed bug GH-15514 (Configure error: genif.sh: syntax error). (Peter Kokot)
- DOM:
. Fixed bug GH-15551 (Segmentation fault (access null pointer) in
ext/dom/xml_common.h). (nielsdos)
- MySQLnd:
. Fixed bug GH-15432 (Heap corruption when querying a vector). (cmb,
Kamil Tekiela)

View File

@@ -184,13 +184,15 @@ static void php_dom_iterator_move_forward(zend_object_iterator *iter) /* {{{ */
bool do_curobj_undef = 1;
php_dom_iterator *iterator = (php_dom_iterator *)iter;
if (Z_ISUNDEF(iterator->curobj)) {
return;
}
intern = Z_DOMOBJ_P(&iterator->curobj);
object = &iterator->intern.data;
nnmap = Z_DOMOBJ_P(object);
objmap = (dom_nnodemap_object *)nnmap->ptr;
intern = Z_DOMOBJ_P(&iterator->curobj);
if (intern != NULL && intern->ptr != NULL) {
if (objmap->nodetype != XML_ENTITY_NODE &&
objmap->nodetype != XML_NOTATION_NODE) {

View File

@@ -0,0 +1,14 @@
--TEST--
GH-15551 (Segmentation fault (access null pointer) in ext/dom/xml_common.h)
--EXTENSIONS--
dom
--FILE--
<?php
$fragment = new DOMDocumentFragment();
$nodes = $fragment->childNodes;
$iter = $nodes->getIterator();
$iter->next();
var_dump($iter->valid());
?>
--EXPECT--
bool(false)