anv: assert that we don't read off the end color_att array
Coverity notices that we've insured that index index is < MAX_RTS in one
case, but that it must be greater in one case. Since `color_att_count`
is a uint32_t, it can easily exceed MAX_RTS (8), and would thus create
an out-of-bounds read situation. While the type system would allow this,
the actually implementation shouldn't, so an assert should make Coverity
happy and help us check our assumption.
CID: 1620440
Fixes: d2f7b6d5a7
("anv: implement VK_KHR_dynamic_rendering_local_read")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31640>
This commit is contained in:
@@ -2091,6 +2091,7 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
|
||||
cmd_buffer->state.gfx.color_output_mapping[binding->index] :
|
||||
binding->index;
|
||||
if (index < cmd_buffer->state.gfx.color_att_count) {
|
||||
assert(index < MAX_RTS);
|
||||
const struct anv_attachment *att =
|
||||
&cmd_buffer->state.gfx.color_att[index];
|
||||
surface_state = att->surface_state.state;
|
||||
|
Reference in New Issue
Block a user