summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-05-26 19:07:35 +0200
committerMarek Olšák <[email protected]>2015-06-05 19:44:32 +0200
commit3d16b5af1dca889ccc3716470f38c1fa84713f26 (patch)
tree3e286de61520e1db6483af525943fdd727dfae22
parent6aff87bb01d2bd583ac629d02ebf56ecbf86ec2c (diff)
tgsi/ureg: fix a coverity defect in emit_decls
Reported by Ilia Mirkin.
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_ureg.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 1cea0919ce4..0eaf1dfa7ae 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -111,7 +111,7 @@ struct ureg_program
} input[UREG_MAX_INPUT];
unsigned nr_inputs, nr_input_regs;
- unsigned vs_inputs[UREG_MAX_INPUT/32];
+ unsigned vs_inputs[PIPE_MAX_ATTRIBS/32];
struct {
unsigned index;
@@ -298,7 +298,8 @@ ureg_DECL_vs_input( struct ureg_program *ureg,
unsigned index )
{
assert(ureg->processor == TGSI_PROCESSOR_VERTEX);
-
+ assert(index / 32 < ARRAY_SIZE(ureg->vs_inputs));
+
ureg->vs_inputs[index/32] |= 1 << (index % 32);
return ureg_src_register( TGSI_FILE_INPUT, index );
}
@@ -1513,7 +1514,7 @@ static void emit_decls( struct ureg_program *ureg )
emit_property(ureg, i, ureg->properties[i]);
if (ureg->processor == TGSI_PROCESSOR_VERTEX) {
- for (i = 0; i < UREG_MAX_INPUT; i++) {
+ for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
if (ureg->vs_inputs[i/32] & (1 << (i%32))) {
emit_decl_range( ureg, TGSI_FILE_INPUT, i, 1 );
}