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

Alexandre Julliard julliard at winehq.org
Wed Apr 1 10:11:27 CDT 2009


Module: wine
Branch: master
Commit: 4194d8040f458116ec1b0e91766646471acc5523
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4194d8040f458116ec1b0e91766646471acc5523

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed Apr  1 12:23:00 2009 +0200

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

---

 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)




More information about the wine-cvs mailing list