pan: fix a bifrost disassembly assert failure

We were overflowing an array during bifrost disassembly. This was
only a problem if the user explicitly set an environment variable,
so unlikely to occur in casual use, and also only could be triggered
in very specific, dense code. But we still should get this right!

The specific CTS test that caused the assert is:

'dEQP-VK.graphicsfuzz.stable-quicksort-for-loop-with-injection'

with environment variable `BIFROST_MESA_DEBUG=shaders`. One of the
shaders has a clause with 6 constants (the maximum) and this overflowed
the array because we assume we always have an extra slot (used for
modifier processing).

Cc: mesa-stable
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38501>
This commit is contained in:
Eric R. Smith 2025-11-17 19:24:46 -04:00 committed by Marge Bot
parent 7a3bfd1f79
commit 65ba14519e

View file

@ -619,10 +619,13 @@ enum bi_constmod {
struct bi_constants {
/* Raw constant values */
uint64_t raw[6];
/* There are at most 6 constants per clause, but internally
* we can use an extra slot for modifiers, so give room for 7
*/
uint64_t raw[7];
/* Associated modifier derived from M values */
enum bi_constmod mods[6];
enum bi_constmod mods[7];
};
/* FAU selectors for constants are out-of-order, construct the top bits