Commit d5c53876 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

ole32: Add a check for hglobal pointer to GetHGlobalFromStream.

parent 019fcaa3
......@@ -664,10 +664,10 @@ HRESULT WINAPI GetHGlobalFromStream(IStream* pstm, HGLOBAL* phglobal)
{
HGLOBALStreamImpl* pStream;
if (pstm == NULL)
if (!pstm || !phglobal)
return E_INVALIDARG;
pStream = (HGLOBALStreamImpl*) pstm;
pStream = impl_from_IStream(pstm);
/*
* Verify that the stream object was created with CreateStreamOnHGlobal.
......
......@@ -561,6 +561,12 @@ static void test_IStream_Clone(void)
hr = CreateStreamOnHGlobal(orig_hmem, TRUE, &stream);
ok(hr == S_OK, "unexpected %#x\n", hr);
hr = GetHGlobalFromStream(stream, NULL);
ok(hr == E_INVALIDARG, "unexpected %#x\n", hr);
hr = GetHGlobalFromStream(NULL, &hmem);
ok(hr == E_INVALIDARG, "unexpected %#x\n", hr);
stream_info(stream, &hmem, &size, &pos);
ok(hmem == orig_hmem, "handles should match\n");
ok(size == 0, "unexpected %d\n", size);
......
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