[PATCH] d3dx9: Validate state operation in d3dx_parse_state().

Paul Gofman gofmanp at gmail.com
Tue Mar 24 12:59:38 CDT 2020


Signed-off-by: Paul Gofman <gofmanp at gmail.com>
---
 dlls/d3dx9_36/effect.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index 5a2ac13358..94a1e05163 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -5905,6 +5905,12 @@ static HRESULT d3dx_parse_state(struct d3dx_effect *effect, struct d3dx_state *s
     state->type = ST_CONSTANT;
 
     read_dword(ptr, &state->operation);
+    if (state->operation >= ARRAY_SIZE(state_table))
+    {
+        WARN("Unknown state operation %u.\n", state->operation);
+        return D3DERR_INVALIDCALL;
+    }
+
     TRACE("Operation: %#x (%s)\n", state->operation, state_table[state->operation].name);
 
     read_dword(ptr, &state->index);
-- 
2.25.1




More information about the wine-devel mailing list