Commit 06cd8d3d authored by Damjan Jovanovic's avatar Damjan Jovanovic Committed by Alexandre Julliard

msxml3: Return S_FALSE from IXMLDOMNamedNodeMap::nextNode() when there are no attributes.

Currently Wine return S_FALSE when IXMLDOMNamedNodeMap::nextNode() has run out of attributes to return, but when an XML node has no attributes at all, it returns S_OK despite setting the nextNode output parameter to NULL, causing the caller to crash when it accesses this pointer. Return S_FALSE in this case instead. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50603Signed-off-by: 's avatarDamjan Jovanovic <damjan.jov@gmail.com> Signed-off-by: 's avatarNikolay Sivov <nsivov@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent f226540e
...@@ -1890,6 +1890,8 @@ static HRESULT domelem_next_node(const xmlNodePtr node, LONG *iter, IXMLDOMNode ...@@ -1890,6 +1890,8 @@ static HRESULT domelem_next_node(const xmlNodePtr node, LONG *iter, IXMLDOMNode
*nextNode = NULL; *nextNode = NULL;
curr = node->properties; curr = node->properties;
if (curr == NULL)
return S_FALSE;
for (i = 0; i < *iter; i++) { for (i = 0; i < *iter; i++) {
if (curr->next == NULL) if (curr->next == NULL)
......
...@@ -2205,6 +2205,8 @@ static void test_domnode( void ) ...@@ -2205,6 +2205,8 @@ static void test_domnode( void )
if (element) if (element)
{ {
IXMLDOMNamedNodeMap *attributes;
owner = NULL; owner = NULL;
r = IXMLDOMElement_get_ownerDocument( element, &owner ); r = IXMLDOMElement_get_ownerDocument( element, &owner );
ok( r == S_OK, "get_ownerDocument return code\n"); ok( r == S_OK, "get_ownerDocument return code\n");
...@@ -2283,6 +2285,29 @@ static void test_domnode( void ) ...@@ -2283,6 +2285,29 @@ static void test_domnode( void )
ok( map != NULL, "should be attributes\n"); ok( map != NULL, "should be attributes\n");
EXPECT_CHILDREN(element); EXPECT_CHILDREN(element);
r = IXMLDOMElement_get_childNodes( element, &list );
ok( r == S_OK, "Expected S_OK, ret %08x\n", r );
r = IXMLDOMNodeList_nextNode( list, &node ); /* <bs> */
ok( r == S_OK, "Expected S_OK, ret %08x\n", r );
IXMLDOMNode_Release( node );
r = IXMLDOMNodeList_nextNode( list, &node ); /* <pr> */
ok( r == S_OK, "Expected S_OK, ret %08x\n", r );
IXMLDOMNode_Release( node );
r = IXMLDOMNodeList_nextNode( list, &node ); /* <empty> */
ok( r == S_OK, "Expected S_OK, ret %08x\n", r );
r = IXMLDOMNode_get_attributes( node, &attributes );
ok( r == S_OK, "Expected S_OK, ret %08x\n", r );
next = (IXMLDOMNode*)0xdeadbeef;
r = IXMLDOMNamedNodeMap_nextNode( attributes, &next );
ok( r == S_FALSE, "Expected S_FALSE, ret %08x\n", r );
ok( next == NULL, "Expected NULL, ret %p\n", next );
IXMLDOMNamedNodeMap_Release( attributes );
IXMLDOMNode_Release( node );
node = NULL;
next = NULL;
IXMLDOMNodeList_Release( list );
list = NULL;
} }
else else
ok( FALSE, "no element\n"); ok( FALSE, "no element\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment