Henri Verbeet : d3d8: Avoid checking the stage index in d3d8_device_GetTextureStageState() (Coverity).

Alexandre Julliard julliard at winehq.org
Tue Mar 3 16:24:55 CST 2020


Module: wine
Branch: master
Commit: 7622d97f784f654e99d72614e2288ef0fae1b618
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=7622d97f784f654e99d72614e2288ef0fae1b618

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Mar  3 19:24:14 2020 +0330

d3d8: Avoid checking the stage index in d3d8_device_GetTextureStageState() (Coverity).

The correct limit for d3d8 would be WINED3D_MAX_TEXTURES, since that's the
size of the "texture_states" array. However, the original code didn't check
the stage index at all, so simply remove it.

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d8/device.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 9793eda0c3..2850b93fd1 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -2250,13 +2250,6 @@ static HRESULT WINAPI d3d8_device_GetTextureStageState(IDirect3DDevice8 *iface,
 
     TRACE("iface %p, stage %u, state %#x, value %p.\n", iface, stage, state, value);
 
-    if (stage >= WINED3D_MAX_FRAGMENT_SAMPLERS)
-    {
-        WARN("Invalid stage %u.\n", stage);
-        *value = 0;
-        return D3D_OK;
-    }
-
     if (state >= ARRAY_SIZE(tss_lookup))
     {
         WARN("Invalid state %#x.\n", state);




More information about the wine-cvs mailing list