tools/trace: Handle index buffer overflow gracefully.
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 31 Jan 2014 16:44:39 +0000 (16:44 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 5 Feb 2014 10:58:38 +0000 (10:58 +0000)
Trivial.

src/gallium/tools/trace/dump_state.py

index 5257100da504f5a94b748b86e4c5571167adaa9d..bde00ec9996a15b5218a71361fa39a5692831cbf 100755 (executable)
@@ -474,7 +474,10 @@ class Context(Dispatcher):
         indices = []
         for i in xrange(info.start, info.start + count):
             offset = self._state.index_buffer.offset + i*index_size
-            index, = unpack_from(format, data, offset)
+            if offset + index_size > len(data):
+                index = 0
+            else:
+                index, = unpack_from(format, data, offset)
             indices.append(index)
             min_index = min(min_index, index)
             max_index = max(max_index, index)