[PATCH resend 1/2] d3d8: Avoid checking the stage index in d3d8_device_GetTextureStageState() (Coverity).

Henri Verbeet hverbeet at codeweavers.com
Tue Mar 3 09:36:14 CST 2020


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>
---
Resending, since the mailing list appears to have eaten some mail yesterday.

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

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 9793eda0c36..2850b93fd1d 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);
-- 
2.20.1




More information about the wine-devel mailing list