summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-07-16 08:44:51 -0600
committerBrian Paul <brianp@vmware.com>2009-07-16 08:44:51 -0600
commit3e8832d24b116b14cf24b81c16e27162a38ffa9e (patch)
tree210f3f345ed3ed347ba628dd04919aa16859c2e5
parent721f80b82ac1f1535f55367d921a2a292eb4898f (diff)
st/mesa: add some array index bounds assertions
-rw-r--r--src/mesa/state_tracker/st_program.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index e4d3bb33c7..806e0ca8f6 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -151,6 +151,7 @@ st_translate_vertex_program(struct st_context *st,
case VERT_ATTRIB_TEX5:
case VERT_ATTRIB_TEX6:
case VERT_ATTRIB_TEX7:
+ assert(slot < Elements(vs_input_semantic_name));
vs_input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
vs_input_semantic_index[slot] = num_generic++;
break;
@@ -171,6 +172,7 @@ st_translate_vertex_program(struct st_context *st,
case VERT_ATTRIB_GENERIC14:
case VERT_ATTRIB_GENERIC15:
assert(attr < VERT_ATTRIB_MAX);
+ assert(slot < Elements(vs_input_semantic_name));
vs_input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
vs_input_semantic_index[slot] = num_generic++;
break;
@@ -198,6 +200,7 @@ st_translate_vertex_program(struct st_context *st,
/* initialize output semantics to defaults */
for (i = 0; i < PIPE_MAX_SHADER_OUTPUTS; i++) {
+ assert(i < Elements(vs_output_semantic_name));
vs_output_semantic_name[i] = TGSI_SEMANTIC_GENERIC;
vs_output_semantic_index[i] = 0;
output_flags[i] = 0x0;
@@ -273,6 +276,7 @@ st_translate_vertex_program(struct st_context *st,
case VERT_RESULT_VAR0:
/* fall-through */
default:
+ assert(slot < Elements(vs_output_semantic_name));
if (outputSemanticName) {
/* use provided semantic into */
assert(outputSemanticName[attr] != TGSI_SEMANTIC_COUNT);
@@ -286,6 +290,7 @@ st_translate_vertex_program(struct st_context *st,
}
}
+ assert(slot < Elements(output_flags));
output_flags[slot] = stvp->Base.Base.OutputFlags[attr];
}
}