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 <liucong2@kylinos.cn>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25446>
This commit is contained in:
Cong Liu
2023-09-28 15:06:44 +08:00
parent d93d989e5d
commit 62b490fa92

View File

@@ -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;
}