amd/common: fix off-by-one in sid_tables.py
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 6 Jun 2017 17:17:49 +0000 (19:17 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 19 Jun 2017 10:03:59 +0000 (12:03 +0200)
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@amd.com>
src/amd/common/sid_tables.py

index fd88d3c..0a2b7ef 100644 (file)
@@ -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' % (