From 7c6f4a6041157eb3d03f1695ef43fda238b13a93 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Thu, 16 Jan 2025 22:27:00 -0500 Subject: [PATCH] elk: Avoid reading past the end of `p->store` On the last iteration of the loop, `offset` will point to the location just beyond the last instruction in the program. If the program exactly fills `p->store` then calling `next_offset()` will read out of bounds. Instead just let the inner while loop call `next_offset()` one additional time. Fixes: a35b9cb6254 ("i965: Add annotation data structure and support code.") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12486 Reviewed-by: Caio Oliveira Part-of: --- src/intel/compiler/elk/elk_eu_compact.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/intel/compiler/elk/elk_eu_compact.c b/src/intel/compiler/elk/elk_eu_compact.c index fc71b7eafb8..3e98e1c5d7e 100644 --- a/src/intel/compiler/elk/elk_eu_compact.c +++ b/src/intel/compiler/elk/elk_eu_compact.c @@ -2127,8 +2127,6 @@ elk_compact_instructions(struct elk_codegen *p, int start_offset, } group->offset = start_offset + offset; - - offset = next_offset(devinfo, store, offset); } }