pvr: Fix OOB access of pbe_{cs,reg}_words

`hw_render->eot_surface_count` also includes surface which don't
need an emit. Using `i` was leading to OOB access when there were
surfaces that didn't need emits, and in total there were
`> PVR_MAX_COLOR_ATTACHMENTS` surfaces.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25584>
This commit is contained in:
Karmjit Mahil
2023-09-27 19:17:20 +01:00
committed by Marge Bot
parent e5feea3826
commit 9d1fc4de72

View File

@@ -1357,8 +1357,8 @@ pvr_setup_emit_state(const struct pvr_device_info *dev_info,
&render_pass_info->render_area,
surface->need_resolve,
samples,
emit_state->pbe_cs_words[i],
emit_state->pbe_reg_words[i]);
emit_state->pbe_cs_words[emit_state->emit_count],
emit_state->pbe_reg_words[emit_state->emit_count]);
emit_state->emit_count += 1;
}