From a4f0a96dda419f9d2cac36d322e828da51fb9181 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Thu, 16 Jan 2025 22:27:00 -0500 Subject: [PATCH] brw: 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/brw_eu_compact.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/intel/compiler/brw_eu_compact.c b/src/intel/compiler/brw_eu_compact.c index 223c347354b..4c51b5300bb 100644 --- a/src/intel/compiler/brw_eu_compact.c +++ b/src/intel/compiler/brw_eu_compact.c @@ -2498,8 +2498,6 @@ brw_compact_instructions(struct brw_codegen *p, int start_offset, } group->offset = start_offset + offset; - - offset = next_offset(devinfo, store, offset); } }