=?UTF-8?Q?Rico=20Sch=C3=BCller=20?=: d3d8: Don' t assert on invalid IDirect3DBaseTexture8 interfaces.
Alexandre Julliard
julliard at winehq.org
Mon Apr 15 13:09:41 CDT 2013
Module: wine
Branch: master
Commit: 1486bdd99ff0d0d7fa39042517736d645ce02675
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1486bdd99ff0d0d7fa39042517736d645ce02675
Author: Rico Schüller <kgbricola at web.de>
Date: Sun Apr 14 16:53:37 2013 +0200
d3d8: Don't assert on invalid IDirect3DBaseTexture8 interfaces.
---
dlls/d3d8/texture.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c
index f139d4e..07695f9 100644
--- a/dlls/d3d8/texture.c
+++ b/dlls/d3d8/texture.c
@@ -1155,9 +1155,20 @@ struct d3d8_texture *unsafe_impl_from_IDirect3DBaseTexture8(IDirect3DBaseTexture
{
if (!iface)
return NULL;
- assert(iface->lpVtbl == (const IDirect3DBaseTexture8Vtbl *)&Direct3DTexture8_Vtbl
- || iface->lpVtbl == (const IDirect3DBaseTexture8Vtbl *)&Direct3DCubeTexture8_Vtbl
- || iface->lpVtbl == (const IDirect3DBaseTexture8Vtbl *)&Direct3DVolumeTexture8_Vtbl);
+
+ /* SetTexture() in particular doesn't do a lot of validation on the pointer
+ * that gets passed in, and passing an invalid pointer works as long as the
+ * application doesn't try to actually render anything with it, so we print
+ * a WARN and return NULL instead of having the usual assert() here.
+ * One application affected by this is Fishdom 2. */
+ if (iface->lpVtbl != (const IDirect3DBaseTexture8Vtbl *)&Direct3DTexture8_Vtbl
+ && iface->lpVtbl != (const IDirect3DBaseTexture8Vtbl *)&Direct3DCubeTexture8_Vtbl
+ && iface->lpVtbl != (const IDirect3DBaseTexture8Vtbl *)&Direct3DVolumeTexture8_Vtbl)
+ {
+ WARN("%p is not a valid IDirect3DBaseTexture8 interface.\n", iface);
+ return NULL;
+ }
+
return CONTAINING_RECORD(iface, struct d3d8_texture, IDirect3DBaseTexture8_iface);
}
More information about the wine-cvs
mailing list