From 0813ec9c917fe4f40a1e9c70e9b3e97f161c4d82 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Fri, 7 Feb 2020 16:02:03 +0330 Subject: [PATCH] wined3d: Properly validate the stage index in wined3d_stateblock_set_texture_stage_state() (Coverity). Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard (cherry picked from commit 125ba807e0d56a2da15875cb485067216505271a) Signed-off-by: Michael Stefaniuc --- dlls/wined3d/stateblock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index f6d36f8c259..499d23fbbd3 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1459,10 +1459,10 @@ void CDECL wined3d_stateblock_set_texture_stage_state(struct wined3d_stateblock return; } - if (stage > WINED3D_MAX_TEXTURES) + if (stage >= WINED3D_MAX_TEXTURES) { WARN("Attempting to set stage %u which is higher than the max stage %u, ignoring.\n", - stage, WINED3D_MAX_TEXTURES); + stage, WINED3D_MAX_TEXTURES - 1); return; }