ddraw: Filter invalid texture stage states passed by the application.

Henri Verbeet hverbeet at codeweavers.com
Wed Apr 1 05:23:00 CDT 2009


---
 dlls/ddraw/device.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 35f3d36..517e7bf 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -4776,6 +4776,13 @@ IDirect3DDeviceImpl_7_GetTextureStageState(IDirect3DDevice7 *iface,
     if(!State)
         return DDERR_INVALIDPARAMS;
 
+    if (TexStageStateType > D3DTSS_TEXTURETRANSFORMFLAGS)
+    {
+        WARN("Invalid TexStageStateType %#x passed.\n", TexStageStateType);
+        *State = 0;
+        return DD_OK;
+    }
+
     EnterCriticalSection(&ddraw_cs);
 
     if (l->sampler_state)
@@ -4896,6 +4903,12 @@ IDirect3DDeviceImpl_7_SetTextureStageState(IDirect3DDevice7 *iface,
     HRESULT hr;
     TRACE("(%p)->(%08x,%08x,%08x): Relay!\n", This, Stage, TexStageStateType, State);
 
+    if (TexStageStateType > D3DTSS_TEXTURETRANSFORMFLAGS)
+    {
+        WARN("Invalid TexStageStateType %#x passed.\n", TexStageStateType);
+        return DD_OK;
+    }
+
     EnterCriticalSection(&ddraw_cs);
 
     if (l->sampler_state)
-- 
1.6.0.6



--------------070103040201060004090303--



More information about the wine-patches mailing list