intel/fs: Protect opt_algebraic from OOB BROADCAST indices
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
This commit is contained in:
@@ -2423,8 +2423,17 @@ fs_visitor::opt_algebraic()
|
|||||||
progress = true;
|
progress = true;
|
||||||
} else if (inst->src[1].file == IMM) {
|
} else if (inst->src[1].file == IMM) {
|
||||||
inst->opcode = BRW_OPCODE_MOV;
|
inst->opcode = BRW_OPCODE_MOV;
|
||||||
inst->src[0] = component(inst->src[0],
|
/* It's possible that the selected component will be too large and
|
||||||
inst->src[1].ud);
|
* overflow the register. This can happen if someone does a
|
||||||
|
* readInvocation() from GLSL or SPIR-V and provides an OOB
|
||||||
|
* invocationIndex. If this happens and we some how manage
|
||||||
|
* to constant fold it in and get here, then component() may cause
|
||||||
|
* us to start reading outside of the VGRF which will lead to an
|
||||||
|
* assert later. Instead, just let it wrap around if it goes over
|
||||||
|
* exec_size.
|
||||||
|
*/
|
||||||
|
const unsigned comp = inst->src[1].ud & (inst->exec_size - 1);
|
||||||
|
inst->src[0] = component(inst->src[0], comp);
|
||||||
inst->sources = 1;
|
inst->sources = 1;
|
||||||
inst->force_writemask_all = true;
|
inst->force_writemask_all = true;
|
||||||
progress = true;
|
progress = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user