summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2014-01-31 16:44:39 +0000
committerJosé Fonseca <[email protected]>2014-02-05 10:58:38 +0000
commit5c975966dcaaa4e781f3baba0fc1e3b7ad4a18a6 (patch)
tree39c01f3bd78e1a05c10406ea9a99921e0b4dd05a
parent16215a9723803f535fd3f49b9988b771d4587d65 (diff)
tools/trace: Handle index buffer overflow gracefully.
Trivial.
-rwxr-xr-xsrc/gallium/tools/trace/dump_state.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gallium/tools/trace/dump_state.py b/src/gallium/tools/trace/dump_state.py
index 5257100da50..bde00ec9996 100755
--- a/src/gallium/tools/trace/dump_state.py
+++ b/src/gallium/tools/trace/dump_state.py
@@ -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)