From 13faa115c5ce4794c0decb5ed2f2bcaa49b14fb9 Mon Sep 17 00:00:00 2001 From: CanerKaraca23 <37447503+CanerKaraca23@users.noreply.github.com> Date: Sat, 4 Apr 2026 11:16:33 +0000 Subject: [PATCH] fix: avoid out-of-bounds array access in modelinfomgr Proper bounds checking for indices returned by GetSirenIndex and GetStrobeIndex before accessing the associated status arrays. --- src/utils/modelinfomgr.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/utils/modelinfomgr.cpp b/src/utils/modelinfomgr.cpp index af43e7f9..2565a01f 100755 --- a/src/utils/modelinfomgr.cpp +++ b/src/utils/modelinfomgr.cpp @@ -263,11 +263,19 @@ RpMaterial *ModelInfoMgr::SetEditableMaterialsCB(RpMaterial *material, void *dat if (iLightIndex == eMaterialType::SirenLight) { - lightOn = data.m_SirenStatus[GetSirenIndex(pCurVeh, material)]; + int idx = GetSirenIndex(pCurVeh, material); + if (idx >= 0 && idx < MAX_LIGHTS) + { + lightOn = data.m_SirenStatus[idx]; + } } else if (iLightIndex == eMaterialType::StrobeLight) { - lightOn = data.m_StrobeStatus[GetStrobeIndex(pCurVeh, material)]; + int idx = GetStrobeIndex(pCurVeh, material); + if (idx >= 0 && idx < MAX_LIGHTS) + { + lightOn = data.m_StrobeStatus[idx]; + } } else if (iLightIndex != eMaterialType::UnknownMaterial) {