Mesa (master): freedreno/decode: Fix overflow

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 3 19:04:55 UTC 2021


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

Author: Rob Clark <robdclark at chromium.org>
Date:   Tue Feb  2 12:12:14 2021 -0800

freedreno/decode: Fix overflow

CP_SET_DRAW_STATE state-groups count as a 4th level of IB.  Fixes a
crash seen on 32b/arm builds of crashdec.

Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8842>

---

 src/freedreno/decode/cffdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/freedreno/decode/cffdec.c b/src/freedreno/decode/cffdec.c
index 10b27b0a236..95411671f59 100644
--- a/src/freedreno/decode/cffdec.c
+++ b/src/freedreno/decode/cffdec.c
@@ -71,7 +71,7 @@ static int is_64b(void)
 }
 
 
-static int draws[3];
+static int draws[4];
 static struct {
 	uint64_t base;
 	uint32_t size;   /* in dwords */
@@ -2656,6 +2656,7 @@ dump_commands(uint32_t *dwords, uint32_t sizedwords, int level)
 		return;
 	}
 
+	assert(ib < ARRAY_SIZE(draws));
 	draws[ib] = 0;
 
 	while (dwords_left > 0) {



More information about the mesa-commit mailing list