- validate the buffer size in HWViewpointBuffer::Set2D.

This was causing crashes in Dragon Sector when writing past the buffer's end.
This commit is contained in:
Christoph Oelckers 2023-01-27 18:25:13 +01:00
parent 70d355cfa3
commit ec04a95929

View file

@ -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();