diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2006-08-13 15:02:41 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2006-08-13 15:02:41 +0000 |
commit | baff4e0ab5c831a5780d0a12b3080994965dd2dc (patch) | |
tree | b85ebc5a7151ed2acd51249fec6d87cb01caf360 | |
parent | 7d0b17fc671395407d35a38ee0d58f0c548dbada (diff) | |
download | php-git-baff4e0ab5c831a5780d0a12b3080994965dd2dc.tar.gz |
Fixed bug #38438 (DOMNodeList->item(0) segfault on empty NodeList)
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | ext/dom/nodelist.c | 2 | ||||
-rw-r--r-- | ext/dom/tests/bug38438.phpt | 13 |
3 files changed, 16 insertions, 2 deletions
@@ -37,6 +37,7 @@ PHP NEWS - Fixed phpinfo() cutoff of variables at \0. (Ilia) - Fixed a bug in the filter extension that prevented magic_quotes_gpc from being applied when RAW filter is used. (Ilia) +- FixedbBug #38438 (DOMNodeList->item(0) segfault on empty NodeList). (Ilia) - Fixed bug #38431 (xmlrpc_get_type() crashes PHP on objects). (Tony) - Fixed bug #38394 (PDO fails to recover from failed prepared statement execution). (Ilia) @@ -45,7 +46,7 @@ PHP NEWS - Fixed bug #38354 (Unwanted reformatting of XML when using AsXML). (Christian) - Fixed bug #38347 (Segmentation fault when using foreach with an unknown/empty SimpleXMLElement). (Tony) -- Fixed bug #38322 (reading past array in sscanf() leads to arbitary code +- Fixed bug #38322 (reading past array in sscanf() leads to arbitrary code execution). (Tony) - Fixed bug #38303 (spl_autoload_register() supress all errors silently). (Ilia) diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c index 8989f907ad..268879bc16 100644 --- a/ext/dom/nodelist.c +++ b/ext/dom/nodelist.c @@ -134,7 +134,7 @@ PHP_FUNCTION(dom_nodelist_item) zval_copy_ctor(return_value); return; } - } else { + } else if (objmap->baseobj) { nodep = dom_object_get_node(objmap->baseobj); if (nodep) { if (objmap->nodetype == XML_ATTRIBUTE_NODE || objmap->nodetype == XML_ELEMENT_NODE) { diff --git a/ext/dom/tests/bug38438.phpt b/ext/dom/tests/bug38438.phpt new file mode 100644 index 0000000000..f51252832c --- /dev/null +++ b/ext/dom/tests/bug38438.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #38438 (DOMNodeList->item(0) segfault on empty NodeList) +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php +$list = new DOMNodeList(); +var_dump($list->item(0)); +echo "OK\n"; +?> +--EXPECT-- +NULL +OK |