intel/vec4: fix out of bounds read
[mesa.git] / src / intel / compiler / brw_vec4_nir.cpp
index 13a5d2f4fa969724e02752d49ebb0dda9eb27fa8..607cfc24d9cc6c98606504ceab1dedaaed971fc2 100644 (file)
@@ -999,7 +999,7 @@ try_immediate_source(const nir_alu_instr *instr, src_reg *op,
 
    case BRW_REGISTER_TYPE_F: {
       int first_comp = -1;
-      float f[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
+      float f[NIR_MAX_VEC_COMPONENTS] = { 0.0f };
       bool is_scalar = true;
 
       for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; i++) {