Skip to content

Commit

Permalink
- validate the buffer size in HWViewpointBuffer::Set2D.
Browse files Browse the repository at this point in the history
This was causing crashes in Dragon Sector when writing past the buffer's end.
  • Loading branch information
coelckers committed Jan 27, 2023
1 parent 70d355c commit ec04a95
Showing 1 changed file with 1 addition and 0 deletions.
Expand Up @@ -96,6 +96,7 @@ void HWViewpointBuffer::Set2D(FRenderState &di, int width, int height, int pll)
matrices.mProjectionMatrix.ortho(0, (float)width, (float)height, 0, -1.0f, 1.0f);
matrices.CalcDependencies();

CheckSize();
mBuffer->Map();
memcpy(((char*)mBuffer->Memory()) + mUploadIndex * mBlockAlign, &matrices, sizeof(matrices));
mBuffer->Unmap();
Expand Down

0 comments on commit ec04a95

Please sign in to comment.