Module: wine Branch: master Commit: 2b5b069dd70ba328dc0ce660861ad802feae912c URL: https://source.winehq.org/git/wine.git/?a=commit;h=2b5b069dd70ba328dc0ce6608...
Author: Paul Gofman gofmanp@gmail.com Date: Tue Mar 24 20:59:38 2020 +0300
d3dx9: Validate state operation in d3dx_parse_state().
Signed-off-by: Paul Gofman gofmanp@gmail.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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 525b87340b..345bee3c3a 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -5564,6 +5564,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);