From cb19fe24d361991104f8dcf54d1e807998766be1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marcin=20=C5=9Alusarz?= Date: Fri, 24 Jul 2020 20:13:00 +0200 Subject: [PATCH] intel/vec4: fix out of bounds read MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit NIR_MAX_VEC_COMPONENTS was bumped from 4 to 16 in a8ec4082 (2019.03.09, merged 2019.12.21) float[4] array was added in acd7796a (2019.06.11, merged 2019.07.11) Found by Coverity. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3014 Signed-off-by: Marcin Ślusarz Fixes: a8ec4082a41 ("nir+vtn: vec8+vec16 support") Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/compiler/brw_vec4_nir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/compiler/brw_vec4_nir.cpp b/src/intel/compiler/brw_vec4_nir.cpp index 13a5d2f4fa9..607cfc24d9c 100644 --- a/src/intel/compiler/brw_vec4_nir.cpp +++ b/src/intel/compiler/brw_vec4_nir.cpp @@ -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++) { -- 2.30.2