[WINESYNC] d3dx9: Secure against unsafe iface to COM object transitions.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id cd3e5020e4c87f49eb042fff9f607b6d745a5d55 by Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
winesync 2020-09-21 22:50:18 +02:00 committed by Jérôme Gardou
parent 13aa089045
commit 9add999c51
2 changed files with 13 additions and 2 deletions

View file

@ -1772,6 +1772,8 @@ static inline struct d3dx_effect_pool *impl_from_ID3DXEffectPool(ID3DXEffectPool
return CONTAINING_RECORD(iface, struct d3dx_effect_pool, ID3DXEffectPool_iface);
}
static inline struct d3dx_effect_pool *unsafe_impl_from_ID3DXEffectPool(ID3DXEffectPool *iface);
static inline struct d3dx_effect *impl_from_ID3DXEffect(ID3DXEffect *iface)
{
return CONTAINING_RECORD(iface, struct d3dx_effect, ID3DXEffect_iface);
@ -6168,8 +6170,8 @@ static HRESULT d3dx9_effect_init(struct d3dx_effect *effect, struct IDirect3DDev
if (pool)
{
effect->pool = unsafe_impl_from_ID3DXEffectPool(pool);
pool->lpVtbl->AddRef(pool);
effect->pool = impl_from_ID3DXEffectPool(pool);
}
IDirect3DDevice9_AddRef(device);
@ -6481,6 +6483,15 @@ static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl =
d3dx_effect_pool_Release
};
static inline struct d3dx_effect_pool *unsafe_impl_from_ID3DXEffectPool(ID3DXEffectPool *iface)
{
if (!iface)
return NULL;
assert(iface->lpVtbl == &ID3DXEffectPool_Vtbl);
return impl_from_ID3DXEffectPool(iface);
}
HRESULT WINAPI D3DXCreateEffectPool(ID3DXEffectPool **pool)
{
struct d3dx_effect_pool *object;

View file

@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc
include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h,
include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h,
include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h}
tags: {wine: 3b951b77f87ed9102fc7a2ccb0807b5592990147}
tags: {wine: cd3e5020e4c87f49eb042fff9f607b6d745a5d55}