summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnuj Phogat <anuj.phogat@gmail.com>2014-09-22 15:10:28 -0700
committerEmil Velikov <emil.l.velikov@gmail.com>2014-10-29 18:11:04 +0000
commit4956788a5f40fff2ea72d0f5bd6fcdb116492896 (patch)
tree9db5d238ceabf91789256592b5854d76d653b15b /src
parentbcf414c1a81de8c951a26e62cecfabb0d6658a55 (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: <mesa-stable@lists.freedesktop.org> Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com> Reviewed-by: Chris Forbes <chrisf@ijw.co.nz> (cherry picked from commit 7a652c41b4de4bdbb954a4ebf6cdb605d197e999) Conflicts: src/glsl/ast_array_index.cpp
Diffstat (limited to 'src')
-rw-r--r--src/glsl/ast_array_index.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/glsl/ast_array_index.cpp b/src/glsl/ast_array_index.cpp
index 5ca85f6ab3f..299ec9121cf 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
@@ -88,7 +88,7 @@ update_max_array_access(ir_rvalue *ir, unsigned idx, YYLTYPE *loc,
unsigned field_index =
deref_record->record->type->field_index(deref_record->field);
assert(field_index < interface_type->length);
- if (idx > deref_var->var->max_ifc_array_access[field_index]) {
+ if (idx > (int)deref_var->var->max_ifc_array_access[field_index]) {
deref_var->var->max_ifc_array_access[field_index] = idx;
/* Check whether this access will, as a side effect, implicitly