Skip to content

Commit

Permalink
- Fixed missing NULL check in SimpleXMLElement::xpath()
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed May 10, 2014
1 parent 5bd443a commit 345f6d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ext/simplexml/simplexml.c
Original file line number Diff line number Diff line change
Expand Up @@ -1270,6 +1270,9 @@ SXE_METHOD(xpath)
if (!sxe->node) {
php_libxml_increment_node_ptr((php_libxml_node_object *)sxe, xmlDocGetRootElement((xmlDocPtr) sxe->document->ptr), NULL TSRMLS_CC);
}
if (!sxe->node) {
RETURN_FALSE;
}

nodeptr = php_sxe_get_first_node(sxe, sxe->node->node TSRMLS_CC);

Expand Down
8 changes: 8 additions & 0 deletions ext/simplexml/tests/SimpleXMLElement_xpath.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--TEST--
Testing xpath() with invalid XML
--FILE--
<?php
$xml = @simplexml_load_string("XXXXXXX^",$x,0x6000000000000001);
var_dump($xml->xpath("BBBB"));
--EXPECT--
bool(false)

0 comments on commit 345f6d9

Please sign in to comment.