From 62b490fa923d2dabe232e5bacd1924fdf254fd48 Mon Sep 17 00:00:00 2001 From: Cong Liu Date: Thu, 28 Sep 2023 15:06:44 +0800 Subject: [PATCH] nir: Fix out-of-bounds access in ntt_emit_store_output() This patch resolves the problem by modifying the for loop condition to ensure that it stays within the bounds of the array (i.e., i < 4) Signed-off-by: Cong Liu Reviewed-by: Gert Wollny Part-of: --- src/gallium/auxiliary/nir/nir_to_tgsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c b/src/gallium/auxiliary/nir/nir_to_tgsi.c index 99b2c70c17a..90924630e87 100644 --- a/src/gallium/auxiliary/nir/nir_to_tgsi.c +++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c @@ -2349,7 +2349,7 @@ ntt_emit_store_output(struct ntt_compile *c, nir_intrinsic_instr *instr) } uint8_t swizzle[4] = { 0, 0, 0, 0 }; - for (int i = frac; i <= 4; i++) { + for (int i = frac; i < 4; i++) { if (out.WriteMask & (1 << i)) swizzle[i] = i - frac; }