From ec04a959294b166a7f6216fc2170d8a46958c5ca Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 27 Jan 2023 18:25:13 +0100 Subject: [PATCH] - validate the buffer size in HWViewpointBuffer::Set2D. This was causing crashes in Dragon Sector when writing past the buffer's end. --- src/common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp b/src/common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp index 3d67b46be..471ee1cb6 100644 --- a/src/common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp +++ b/src/common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp @@ -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();