From 35ae01023bbfe1963a099f6d717367ca6f156adf Mon Sep 17 00:00:00 2001 From: Daniel Lehman Date: Fri, 22 Oct 2021 16:41:28 +0300 Subject: [PATCH] msxml3: Handle NULL XML declaration. Signed-off-by: Daniel Lehman Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/msxml3/pi.c | 3 +++ dlls/msxml3/tests/domdoc.c | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/msxml3/pi.c b/dlls/msxml3/pi.c index 1d96c9391ee..4c5c6b12c68 100644 --- a/dlls/msxml3/pi.c +++ b/dlls/msxml3/pi.c @@ -754,6 +754,9 @@ HRESULT dom_pi_put_xml_decl(IXMLDOMNode *node, BSTR data) HRESULT hr; BSTR name; + if (!data) + return XML_E_XMLDECLSYNTAX; + node_obj = get_node_obj(node); hr = node_set_content(node_obj, data); if (FAILED(hr)) diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 22fbe06abd7..70e2da89a2f 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -8596,7 +8596,6 @@ static void test_createProcessingInstruction(void) hr = IXMLDOMDocument_createProcessingInstruction(doc, NULL, _bstr_("version=\"1.0\" encoding=\"UTF-8\""), &pi); ok(hr == E_FAIL, "got 0x%08x\n", hr); hr = IXMLDOMDocument_createProcessingInstruction(doc, _bstr_("xml"), NULL, &pi); -todo_wine ok(hr == XML_E_XMLDECLSYNTAX, "got 0x%08x\n", hr); hr = IXMLDOMDocument_createProcessingInstruction(doc, _bstr_("xml"), _bstr_("version=\"1.0\" encoding=UTF-8"), &pi); ok(hr == XML_E_MISSINGQUOTE, "got 0x%08x\n", hr); -- 2.11.4.GIT