diff options
author | Ilia Mirkin <[email protected]> | 2016-10-19 00:05:26 -0400 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2016-10-19 21:02:01 -0400 |
commit | 313fba5ee1de9416930e45da8aff63a24763940b (patch) | |
tree | 16a72761bb195d1e14500adc6168d4b40f9eb894 /src/gallium/drivers/nouveau/nvc0/nvc0_program.c | |
parent | 8bf7717e1f84d180f42fb665772878d3b6d27459 (diff) |
nv50,nvc0: avoid reading out of bounds when getting bogus so info
The state tracker tries to attach the info to the wrong shader. This is
easy enough to protect against.
Signed-off-by: Ilia Mirkin <[email protected]>
Reviewed-by: Samuel Pitoiset <[email protected]>
Cc: 12.0 13.0 <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau/nvc0/nvc0_program.c')
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_program.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c index f52cbd29819..a4a164f15f8 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c @@ -509,11 +509,14 @@ nvc0_program_create_tfb_state(const struct nv50_ir_prog_info *info, for (i = 0; i < pso->num_outputs; ++i) { unsigned s = pso->output[i].start_component; unsigned p = pso->output[i].dst_offset; + const unsigned r = pso->output[i].register_index; b = pso->output[i].output_buffer; + if (r >= info->numOutputs) + continue; + for (c = 0; c < pso->output[i].num_components; ++c) - tfb->varying_index[b][p++] = - info->out[pso->output[i].register_index].slot[s + c]; + tfb->varying_index[b][p++] = info->out[r].slot[s + c]; tfb->varying_count[b] = MAX2(tfb->varying_count[b], p); tfb->stream[b] = pso->output[i].stream; |