Paul Gofman : d3dx9: Return an error for out of bounds input register in parse_preshader().
Alexandre Julliard
julliard at winehq.org
Fri Apr 28 12:44:30 CDT 2017
Module: wine
Branch: master
Commit: 30bc3bab3090dce8e96880fb9f0026473dc18379
URL: http://source.winehq.org/git/wine.git/?a=commit;h=30bc3bab3090dce8e96880fb9f0026473dc18379
Author: Paul Gofman <gofmanp at gmail.com>
Date: Thu Apr 27 14:05:46 2017 +0300
d3dx9: Return an error for out of bounds input register in parse_preshader().
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 | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dx9_36/preshader.c b/dlls/d3dx9_36/preshader.c
index 0f23488..a5a8bb7 100644
--- a/dlls/d3dx9_36/preshader.c
+++ b/dlls/d3dx9_36/preshader.c
@@ -749,6 +749,7 @@ static HRESULT parse_preshader(struct d3dx_preshader *pres, unsigned int *ptr, u
pres->regs.table_sizes[PRES_REGTAB_IMMED] = const_count;
+ update_table_sizes_consts(pres->regs.table_sizes, &pres->inputs);
for (i = 0; i < pres->ins_count; ++i)
{
for (j = 0; j < pres_op_info[pres->ins[i].op].input_count; ++j)
@@ -770,13 +771,17 @@ static HRESULT parse_preshader(struct d3dx_preshader *pres, unsigned int *ptr, u
table = pres->ins[i].inputs[j].index_reg.table;
reg_idx = get_reg_offset(table, pres->ins[i].inputs[j].index_reg.offset);
}
- update_table_size(pres->regs.table_sizes, table, reg_idx);
+ if (reg_idx >= pres->regs.table_sizes[table])
+ {
+ FIXME("Out of bounds register index, i %u, j %u, table %u, reg_idx %u.",
+ i, j, table, reg_idx);
+ return D3DXERR_INVALIDDATA;
+ }
}
update_table_size(pres->regs.table_sizes, pres->ins[i].output.reg.table,
get_reg_offset(pres->ins[i].output.reg.table,
pres->ins[i].output.reg.offset + pres->ins[i].component_count - 1));
}
- update_table_sizes_consts(pres->regs.table_sizes, &pres->inputs);
if (FAILED(regstore_alloc_table(&pres->regs, PRES_REGTAB_IMMED)))
return E_OUTOFMEMORY;
regstore_set_values(&pres->regs, PRES_REGTAB_IMMED, dconst, 0, const_count);
More information about the wine-cvs
mailing list