Mesa (master): amd/common: fix off-by-one in sid_tables.py

Nicolai Hähnle nh at kemper.freedesktop.org
Mon Jun 19 10:07:25 UTC 2017


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

Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
Date:   Tue Jun  6 19:17:49 2017 +0200

amd/common: fix off-by-one in sid_tables.py

The very last entry in the sid_strings_offsets table ended up missing,
leading to out-of-bounds reads and potential crashes.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/amd/common/sid_tables.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/amd/common/sid_tables.py b/src/amd/common/sid_tables.py
index fd88d3c9d5..0a2b7ef1fe 100644
--- a/src/amd/common/sid_tables.py
+++ b/src/amd/common/sid_tables.py
@@ -110,7 +110,7 @@ class IntTable:
         [static] const typename name[] = { ... };
         to filp.
         """
-        idxs = sorted(self.idxs) + [-1]
+        idxs = sorted(self.idxs) + [len(self.table)]
 
         fragments = [
             ('\t/* %s */ %s' % (




More information about the mesa-commit mailing list