From 5c975966dcaaa4e781f3baba0fc1e3b7ad4a18a6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 31 Jan 2014 16:44:39 +0000 Subject: [PATCH] tools/trace: Handle index buffer overflow gracefully. Trivial. --- src/gallium/tools/trace/dump_state.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) -- 2.30.2