diff options
author | Anuj Phogat <[email protected]> | 2014-09-22 15:10:28 -0700 |
---|---|---|
committer | Anuj Phogat <[email protected]> | 2014-10-22 16:13:37 -0700 |
commit | 7a652c41b4de4bdbb954a4ebf6cdb605d197e999 (patch) | |
tree | 8a438097f912124820acdddf5d9c083fea3febe2 /src | |
parent | 6f0089e92e9a3b096b978bb09a87db6a38acb7b2 (diff) |
glsl: Use signed array index in update_max_array_access()
Avoids a crash in case of negative array index is used in a
shader program.
Cc: <[email protected]>
Signed-off-by: Anuj Phogat <[email protected]>
Reviewed-by: Chris Forbes <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/ast_array_index.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/glsl/ast_array_index.cpp b/src/glsl/ast_array_index.cpp index 49a8574f2b8..ff0c7576db0 100644 --- a/src/glsl/ast_array_index.cpp +++ b/src/glsl/ast_array_index.cpp @@ -49,12 +49,12 @@ ast_array_specifier::print(void) const * loc and state to report the error. */ static void -update_max_array_access(ir_rvalue *ir, unsigned idx, YYLTYPE *loc, +update_max_array_access(ir_rvalue *ir, int idx, YYLTYPE *loc, struct _mesa_glsl_parse_state *state) { if (ir_dereference_variable *deref_var = ir->as_dereference_variable()) { ir_variable *var = deref_var->var; - if (idx > var->data.max_array_access) { + if (idx > (int)var->data.max_array_access) { var->data.max_array_access = idx; /* Check whether this access will, as a side effect, implicitly cause @@ -94,7 +94,7 @@ update_max_array_access(ir_rvalue *ir, unsigned idx, YYLTYPE *loc, assert(max_ifc_array_access != NULL); - if (idx > max_ifc_array_access[field_index]) { + if (idx > (int)max_ifc_array_access[field_index]) { max_ifc_array_access[field_index] = idx; /* Check whether this access will, as a side effect, implicitly |