Skip to content

Commit f720931

Browse files
HeightMap: Add safety check for vertex buffer arrays before access
1 parent fa74ece commit f720931

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

  • GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient
  • Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,11 @@ Int HeightMapRenderObjClass::updateBlock(Int x0, Int y0, Int x1, Int y1, WorldH
11541154
REF_PTR_SET(m_stageOneTexture, pMap->getAlphaTerrainTexture());
11551155
}
11561156

1157+
// Validate vertex buffer arrays before access to prevent race condition during resource cleanup
1158+
if (!m_vertexBufferTiles || !m_vertexBufferBackup) {
1159+
return -1;
1160+
}
1161+
11571162
Int i,j;
11581163
DX8VertexBufferClass **pVB;
11591164
Int originX,originY;

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,11 @@ Int HeightMapRenderObjClass::updateBlock(Int x0, Int y0, Int x1, Int y1, WorldH
10241024
REF_PTR_SET(m_stageOneTexture, pMap->getAlphaTerrainTexture());
10251025
}
10261026

1027+
// Validate vertex buffer arrays before access to prevent race condition during resource cleanup
1028+
if (!m_vertexBufferTiles || !m_vertexBufferBackup) {
1029+
return -1;
1030+
}
1031+
10271032
Int i,j;
10281033
DX8VertexBufferClass **pVB;
10291034
Int originX,originY;

0 commit comments

Comments
 (0)