mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 11:00:11 +01:00
mesa/program: fix nir output reg overflow
outputs_written is uint64_t, should count max reg number by util_last_bit64(). Otherwise the following access will overflow the allocated array with a smaller size. cc: mesa-stable Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765>
This commit is contained in:
parent
28801cfba0
commit
feea8fed44
1 changed files with 1 additions and 1 deletions
|
|
@ -916,7 +916,7 @@ setup_registers_and_variables(struct ptn_compile *c)
|
|||
}
|
||||
|
||||
/* Create output registers and variables. */
|
||||
int max_outputs = util_last_bit(c->prog->info.outputs_written);
|
||||
int max_outputs = util_last_bit64(c->prog->info.outputs_written);
|
||||
c->output_regs = rzalloc_array(c, nir_register *, max_outputs);
|
||||
|
||||
uint64_t outputs_written = c->prog->info.outputs_written;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue