Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Bounds check on bitmap add.
Browse files Browse the repository at this point in the history
  • Loading branch information
riperiperi authored and gdkchan committed Jul 10, 2022
1 parent 1d6aa7f commit c3257bd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Ryujinx.Graphics.Vulkan/BufferUsageBitmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ public BufferUsageBitmap(int size, int granularity)

public void Add(int cbIndex, int offset, int size)
{
// Some usages can be out of bounds (vertex buffer on amd), so bound if necessary.
if (offset + size > _size)
{
size = _size - offset;
}

int cbBase = cbIndex * _bitsPerCb;
int start = cbBase + offset / _granularity;
int end = cbBase + (offset + size - 1) / _granularity;
Expand Down

0 comments on commit c3257bd

Please sign in to comment.