diff --git a/dlls/msxml3/saxreader.c b/dlls/msxml3/saxreader.c index c610ffcaccb..8c202bddccd 100644 --- a/dlls/msxml3/saxreader.c +++ b/dlls/msxml3/saxreader.c @@ -2728,23 +2728,23 @@ static HRESULT internal_onDataAvailable(void *obj, char *ptr, DWORD len) return internal_parseBuffer(This, ptr, len, FALSE); } -static HRESULT internal_parseURL( - saxreader* This, - const WCHAR *url, - BOOL vbInterface) +static HRESULT internal_parseURL(saxreader *reader, const WCHAR *url, BOOL vbInterface) { IMoniker *mon; bsc_t *bsc; HRESULT hr; - TRACE("(%p)->(%s)\n", This, debugstr_w(url)); + TRACE("%p, %s.\n", reader, debugstr_w(url)); + + if (!url && reader->version < MSXML4) + return E_INVALIDARG; hr = create_moniker_from_url(url, &mon); if(FAILED(hr)) return hr; - if(vbInterface) hr = bind_url(mon, internal_vbonDataAvailable, This, &bsc); - else hr = bind_url(mon, internal_onDataAvailable, This, &bsc); + if(vbInterface) hr = bind_url(mon, internal_vbonDataAvailable, reader, &bsc); + else hr = bind_url(mon, internal_onDataAvailable, reader, &bsc); IMoniker_Release(mon); if(FAILED(hr)) diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c index ad093af6a12..20c5e07443b 100644 --- a/dlls/msxml3/tests/saxreader.c +++ b/dlls/msxml3/tests/saxreader.c @@ -2325,6 +2325,22 @@ static void test_saxreader(void) WriteFile(file, testXML, sizeof(testXML)-1, &written, NULL); CloseHandle(file); + /* crashes on newer versions */ + if (IsEqualGUID(table->clsid, &CLSID_SAXXMLReader) || + IsEqualGUID(table->clsid, &CLSID_SAXXMLReader30)) + { + IVBSAXXMLReader *vb_reader; + + hr = ISAXXMLReader_parseURL(reader, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + + hr = ISAXXMLReader_QueryInterface(reader, &IID_IVBSAXXMLReader, (void **)&vb_reader); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IVBSAXXMLReader_parseURL(vb_reader, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); + IVBSAXXMLReader_Release(vb_reader); + } + if (IsEqualGUID(table->clsid, &CLSID_SAXXMLReader40) || IsEqualGUID(table->clsid, &CLSID_SAXXMLReader60)) test_seq = content_handler_test1_alternate;