From: Rhys Perry Date: Fri, 17 Jan 2020 11:35:20 +0000 (+0000) Subject: aco: fix stack buffer overflow in apply_sgprs() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e151398de61f53ecc6b19a34d33748a4c9e99abf;p=mesa.git aco: fix stack buffer overflow in apply_sgprs() Signed-off-by: Rhys Perry Fixes: cef78797191 ('aco: rewrite apply_sgprs()') Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2361 Tested-by: Marge Bot Part-of: --- diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index d8e42d88b7d..8c2514598f0 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -2112,7 +2112,8 @@ void apply_sgprs(opt_ctx &ctx, aco_ptr& instr) continue; } - sgpr_ids[num_sgprs++] = sgpr.id(); + if (new_sgpr) + sgpr_ids[num_sgprs++] = sgpr.id(); ctx.uses[sgpr_info_id]--; ctx.uses[sgpr.id()]++; }