[WINESYNC] 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>

wine commit id 2b5b069dd70ba328dc0ce660861ad802feae912c by Paul Gofman <gofmanp@gmail.com>
This commit is contained in:
winesync 2020-09-21 23:07:32 +02:00 committed by Jérôme Gardou
parent 777269ea64
commit 51b2c71b54
2 changed files with 7 additions and 1 deletions

View file

@ -5568,6 +5568,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);

View file

@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc
include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h,
include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h,
include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h}
tags: {wine: cfc533b40d2d1426a8f05501152b28aa1ec78f07}
tags: {wine: 2b5b069dd70ba328dc0ce660861ad802feae912c}