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: a35b9cb625 ("i965: Add annotation data structure and support code.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12486
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33101>
This commit is contained in:
Matt Turner 2025-01-16 22:27:00 -05:00 committed by Marge Bot
parent 88fd100f97
commit 7c6f4a6041

View file

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