From 1bcd49d2d4899b2b1b64f43cf987f33082116f4c Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Sun, 19 Oct 2025 17:05:12 +0000 Subject: [PATCH] TextureFilterClass: Add bounds check for texture stage in Apply --- .../Code/Libraries/Source/WWVegas/WW3D2/texturefilter.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texturefilter.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texturefilter.cpp index 7fb9b85a24e..4f5064ad4a7 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texturefilter.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texturefilter.cpp @@ -69,6 +69,12 @@ TextureFilterClass::TextureFilterClass(MipCountType mip_level_count) */ void TextureFilterClass::Apply(unsigned int stage) { + // Bounds check to prevent array access violation + if (stage >= MAX_TEXTURE_STAGES) + { + return; + } + DX8Wrapper::Set_DX8_Texture_Stage_State(stage,D3DTSS_MINFILTER,_MinTextureFilters[stage][TextureMinFilter]); DX8Wrapper::Set_DX8_Texture_Stage_State(stage,D3DTSS_MAGFILTER,_MagTextureFilters[stage][TextureMagFilter]); DX8Wrapper::Set_DX8_Texture_Stage_State(stage,D3DTSS_MIPFILTER,_MipMapFilters[stage][MipMapFilter]);