aco/isel: Fix out-of-bounds write in visit_load_input
Shaders may read out components past the attributes provided by the application, so the read mask can indicate a larger component count than were actually reserved in the array. Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6728>
This commit is contained in:
parent
d38094bb33
commit
5f7810dcb2
|
@ -4568,7 +4568,7 @@ void visit_load_input(isel_context *ctx, nir_intrinsic_instr *instr)
|
|||
/* skip unused channels at the start */
|
||||
if (vtx_info->chan_byte_size && !post_shuffle) {
|
||||
channel_start = ffs(mask) - 1;
|
||||
for (unsigned i = 0; i < channel_start; i++)
|
||||
for (unsigned i = 0; i < MIN2(channel_start, num_channels); i++)
|
||||
channels[i] = Temp(0, s1);
|
||||
} else if (vtx_info->chan_byte_size && post_shuffle && !(mask & 0x8)) {
|
||||
num_channels = 3 - (ffs(mask) - 1);
|
||||
|
|
Loading…
Reference in New Issue