Commit 37745b09 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

oleaut32: Fix AddFuncDesc() to ignore scodes array length when NULL array pointer is passed.

parent 5c4cbc9d
......@@ -2033,6 +2033,8 @@ static void test_CreateTypeLib(SYSKIND sys) {
funcdesc.lprgelemdescParam = NULL;
funcdesc.invkind = INVOKE_FUNC;
funcdesc.cParams = 0;
funcdesc.cScodes = 1;
funcdesc.lprgscode = NULL;
hres = ICreateTypeInfo_AddFuncDesc(createti, 1, &funcdesc);
ok(hres == S_OK, "got %08x\n", hres);
......
......@@ -10431,11 +10431,13 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(ICreateTypeInfo2 *iface,
if (tmp_func_desc.funcdesc.oVft != 0)
tmp_func_desc.funcdesc.oVft |= 1;
if (funcDesc->cScodes) {
if (funcDesc->cScodes && funcDesc->lprgscode) {
tmp_func_desc.funcdesc.lprgscode = heap_alloc(sizeof(SCODE) * funcDesc->cScodes);
memcpy(tmp_func_desc.funcdesc.lprgscode, funcDesc->lprgscode, sizeof(SCODE) * funcDesc->cScodes);
} else
} else {
tmp_func_desc.funcdesc.lprgscode = NULL;
tmp_func_desc.funcdesc.cScodes = 0;
}
buf_size = TLB_SizeElemDesc(&funcDesc->elemdescFunc);
for (i = 0; i < funcDesc->cParams; ++i) {
......
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