Skip to content

Commit

Permalink
Minor fix to avoid crash in getIndicesData
Browse files Browse the repository at this point in the history
  • Loading branch information
Qining authored and AWoloszyn committed Jul 27, 2017
1 parent 9f78848 commit 7a13c8d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gapis/api/vulkan/draw_call_mesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7a13c8d

Please sign in to comment.