diff options
author | Rhys Perry <[email protected]> | 2020-01-17 11:35:20 +0000 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-01-20 11:13:11 +0000 |
commit | e151398de61f53ecc6b19a34d33748a4c9e99abf (patch) | |
tree | e330862ca3658dfed7f86b49e010f8eee5d519b7 | |
parent | 9b2ccd6a0e98b0c70f9dae275f4a2d0b43219709 (diff) |
aco: fix stack buffer overflow in apply_sgprs()
Signed-off-by: Rhys Perry <[email protected]>
Fixes: cef78797191 ('aco: rewrite apply_sgprs()')
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2361
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3442>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3442>
-rw-r--r-- | src/amd/compiler/aco_optimizer.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
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<Instruction>& 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()]++; } |