nir/search: Assert that variable id's are in range
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 8 May 2015 16:42:05 +0000 (09:42 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 9 May 2015 00:29:15 +0000 (17:29 -0700)
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/glsl/nir/nir_search.c

index 713dc4eedff4694a7da425fce3bb62f52915bdd2..1c171f2a7291bd4db0e5bba39f60685a31c08090 100644 (file)
@@ -98,6 +98,7 @@ match_value(const nir_search_value *value, nir_alu_instr *instr, unsigned src,
 
    case nir_search_value_variable: {
       nir_search_variable *var = nir_search_value_as_variable(value);
+      assert(var->variable < NIR_SEARCH_MAX_VARIABLES);
 
       if (state->variables_seen & (1 << var->variable)) {
          if (!nir_srcs_equal(state->variables[var->variable].src,