Nikolay Sivov : msxml3: Handle NULL child in appendChild().

Alexandre Julliard julliard at winehq.org
Thu Apr 3 13:31:15 CDT 2014


Module: wine
Branch: master
Commit: db8ff72f003f1919cae1d3adb674400066790558
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=db8ff72f003f1919cae1d3adb674400066790558

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Apr  3 10:04:34 2014 +0400

msxml3: Handle NULL child in appendChild().

---

 dlls/msxml3/node.c         |    3 +++
 dlls/msxml3/tests/domdoc.c |    6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index e3016a5..1319d77 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -625,6 +625,9 @@ HRESULT node_append_child(xmlnode *This, IXMLDOMNode *child, IXMLDOMNode **outCh
     VARIANT var;
     HRESULT hr;
 
+    if (!child)
+        return E_INVALIDARG;
+
     hr = IXMLDOMNode_get_nodeType(child, &type);
     if(FAILED(hr) || type == NODE_ATTRIBUTE) {
         if (outChild) *outChild = NULL;
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index aaa895a..0c700c3 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -8878,6 +8878,12 @@ static void test_appendChild(void)
     EXPECT_NO_CHILDREN(doc);
     EXPECT_NO_CHILDREN(doc2);
 
+    hr = IXMLDOMDocument_appendChild(doc2, NULL, NULL);
+    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+
+    hr = IXMLDOMElement_appendChild(elem, NULL, NULL);
+    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+
     /* append from another document */
     hr = IXMLDOMDocument_appendChild(doc2, (IXMLDOMNode*)elem, NULL);
     ok(hr == S_OK, "got 0x%08x\n", hr);




More information about the wine-cvs mailing list