Mesa (master): pan/midgard: Fix memory corruption in constant combining

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 2 23:03:49 UTC 2020


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

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Thu Jan  2 13:44:40 2020 -0500

pan/midgard: Fix memory corruption in constant combining

It's a long story... but we'd try to insert constants that weren't there
and end up clobbering fields in the bundle following the constant
array...

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>

---

 src/panfrost/midgard/midgard_schedule.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c
index d4239157ead..a78bb901b43 100644
--- a/src/panfrost/midgard/midgard_schedule.c
+++ b/src/panfrost/midgard/midgard_schedule.c
@@ -415,7 +415,7 @@ mir_adjust_constants(midgard_instruction *ins,
 
                         /* If the constant is new, check ourselves */
                         for (unsigned j = 0; j < i; ++j) {
-                                if (constants[j] == constants[i]) {
+                                if (constants[j] == constants[i] && (mask & (1 << j))) {
                                         ok = true;
                                         break;
                                 }




More information about the mesa-commit mailing list