intel/brw: Handle SHADER_OPCODE_SEND without src[3] in copy prop

We construct some SENDs with only 3 sources (such as FB writes).
This code could read out of bounds.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27876>
This commit is contained in:
Kenneth Graunke 2024-01-08 20:58:20 -08:00 committed by Marge Bot
parent 49606ab067
commit f6ac6c94a9

View file

@ -698,7 +698,8 @@ try_copy_propagate(const brw_compiler *compiler, fs_inst *inst,
* We need to pin both split SEND sources in g112-g126/127, so only
* allow this if the registers aren't too large.
*/
if (inst->opcode == SHADER_OPCODE_SEND && entry->src.file == VGRF) {
if (inst->opcode == SHADER_OPCODE_SEND && inst->sources >= 4 &&
entry->src.file == VGRF) {
int other_src = arg == 2 ? 3 : 2;
unsigned other_size = inst->src[other_src].file == VGRF ?
alloc.sizes[inst->src[other_src].nr] :