Paul Gofman : d3dx9: Check type and register count for sampler constants.
Alexandre Julliard
julliard at winehq.org
Wed Jul 5 15:41:02 CDT 2017
Module: wine
Branch: master
Commit: a7ea12c94374c7657630168b1e8d6cb800c71cad
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a7ea12c94374c7657630168b1e8d6cb800c71cad
Author: Paul Gofman <gofmanp at gmail.com>
Date: Wed Jun 28 14:28:22 2017 +0300
d3dx9: Check type and register count for sampler constants.
Signed-off-by: Paul Gofman <gofmanp at gmail.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3dx9_36/preshader.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dx9_36/preshader.c b/dlls/d3dx9_36/preshader.c
index 911ca79..2fb14ab 100644
--- a/dlls/d3dx9_36/preshader.c
+++ b/dlls/d3dx9_36/preshader.c
@@ -654,10 +654,28 @@ static HRESULT get_constants_desc(unsigned int *byte_code, struct d3dx_const_tab
if (FAILED(hr = get_ctab_constant_desc(ctab, hc, &cdesc[i])))
goto err_out;
inputs_param[i] = get_parameter_by_name(base, NULL, cdesc[i].Name);
+ if (!inputs_param[i])
+ {
+ WARN("Could not find parameter %s in effect.\n", cdesc[i].Name);
+ continue;
+ }
if (cdesc[i].Class == D3DXPC_OBJECT)
+ {
TRACE("Object %s, parameter %p.\n", cdesc[i].Name, inputs_param[i]);
- else if (!inputs_param[i])
- WARN("Could not find parameter %s in effect.\n", cdesc[i].Name);
+ if (cdesc[i].RegisterSet != D3DXRS_SAMPLER || inputs_param[i]->class != D3DXPC_OBJECT
+ || !is_param_type_sampler(inputs_param[i]->type))
+ {
+ WARN("Unexpected object type, constant %s.\n", debugstr_a(cdesc[i].Name));
+ hr = D3DERR_INVALIDCALL;
+ goto err_out;
+ }
+ if (max(inputs_param[i]->element_count, 1) < cdesc[i].RegisterCount)
+ {
+ WARN("Register count exceeds parameter size, constant %s.\n", debugstr_a(cdesc[i].Name));
+ hr = D3DERR_INVALIDCALL;
+ goto err_out;
+ }
+ }
}
out->input_count = desc.Constants;
out->inputs = cdesc;
More information about the wine-cvs
mailing list