Commit 33582cc6 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

oleaut32: Add some validation for the DISPPARAMS structure in ITypeInfo::Invoke.

parent e3e42985
......@@ -461,6 +461,15 @@ static void test_TypeInfo(void)
hr = ITypeInfo_Invoke(pTypeInfo, (void *)0xdeadbeef, dispidMember, DISPATCH_PROPERTYGET, &dispparams, NULL, NULL, NULL);
ok(hr == DISP_E_MEMBERNOTFOUND, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08lx\n", hr);
/* test NULL dispparams */
hr = ITypeInfo_Invoke(pTypeInfo, (void *)0xdeadbeef, dispidMember, DISPATCH_METHOD, NULL, NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
/* test dispparams->cNamedArgs being bigger than dispparams->cArgs */
dispparams.cNamedArgs = 1;
hr = ITypeInfo_Invoke(pTypeInfo, (void *)0xdeadbeef, dispidMember, DISPATCH_METHOD, &dispparams, NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
ITypeInfo_Release(pTypeInfo);
hr = ITypeLib_GetTypeInfoOfGuid(pTypeLib, &IID_IDispatch, &pTypeInfo);
......
......@@ -5218,8 +5218,22 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
TRACE("(%p)(%p,id=%ld,flags=0x%08x,%p,%p,%p,%p)\n",
This,pIUnk,memid,wFlags,pDispParams,pVarResult,pExcepInfo,pArgErr
);
if (!pDispParams)
{
ERR("NULL pDispParams not allowed\n");
return E_INVALIDARG;
}
dump_DispParms(pDispParams);
if (pDispParams->cNamedArgs > pDispParams->cArgs)
{
ERR("named argument array cannot be bigger than argument array (%d/%d)\n",
pDispParams->cNamedArgs, pDispParams->cArgs);
return E_INVALIDARG;
}
/* we do this instead of using GetFuncDesc since it will return a fake
* FUNCDESC for dispinterfaces and we want the real function description */
for (pFuncInfo = This->funclist; pFuncInfo; pFuncInfo=pFuncInfo->next)
......
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