| diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp |
| index 56cb447..a86c9bd 100644 |
| --- a/src/mesa/drivers/dri/i965/brw_fs.cpp |
| +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp |
| @@ -1121,7 +1121,12 @@ fs_visitor::remove_dead_constants() |
| if (inst->src[i].file != UNIFORM) |
| continue; |
| |
| - assert(constant_nr < (int)c->prog_data.nr_params); |
| + if (constant_nr >= (int)c->prog_data.nr_params) { |
| + ralloc_free(this->params_remap); |
| + this->params_remap = NULL; |
| + fail("accessed non-existent uniform"); |
| + return false; |
| + } |
| |
| /* For now, set this to non-negative. We'll give it the |
| * actual new number in a moment, in order to keep the |
| diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |
| index 2dd212a..0593a1f 100644 |
| --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |
| +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |
| @@ -2270,6 +2270,8 @@ fs_visitor::fs_visitor(struct brw_wm_compile *c, struct gl_shader_program *prog, |
| this->virtual_grf_use = NULL; |
| this->live_intervals_valid = false; |
| |
| + this->params_remap = NULL; |
| + |
| this->force_uncompressed_stack = 0; |
| this->force_sechalf_stack = 0; |
| } |