From 7a13c8d5204c2669fbf7d653f502467be8cc43d9 Mon Sep 17 00:00:00 2001 From: Qining Lu Date: Thu, 27 Jul 2017 14:39:35 -0400 Subject: [PATCH] Minor fix to avoid crash in getIndicesData --- gapis/api/vulkan/draw_call_mesh.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gapis/api/vulkan/draw_call_mesh.go b/gapis/api/vulkan/draw_call_mesh.go index 83edb0f5c7..48fa9c76fc 100644 --- a/gapis/api/vulkan/draw_call_mesh.go +++ b/gapis/api/vulkan/draw_call_mesh.go @@ -166,6 +166,10 @@ func getIndicesData(ctx context.Context, s *api.State, boundIndexBuffer *BoundIn start := offset + uint64(firstIndex)*sizeOfIndex size := uint64(indexCount) * sizeOfIndex end := start + size + if start >= backingMem.Data.count || end > backingMem.Data.count { + log.E(ctx, "Shadow memory of index buffer is not big enough") + return []uint32{} + } indicesSlice := backingMem.Data.Slice(start, end, s.MemoryLayout) for i := uint64(0); (i < size) && (i+sizeOfIndex-1 < size); i += sizeOfIndex { index := int32(0)