Mesa (master): aco: fix stack buffer overflow in apply_sgprs()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 20 11:34:40 UTC 2020


Module: Mesa
Branch: master
Commit: e151398de61f53ecc6b19a34d33748a4c9e99abf
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e151398de61f53ecc6b19a34d33748a4c9e99abf

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Fri Jan 17 11:35:20 2020 +0000

aco: fix stack buffer overflow in apply_sgprs()

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
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>

---

 src/amd/compiler/aco_optimizer.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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()]++;
    }



More information about the mesa-commit mailing list