From 291e393f7ed6b293b0f787a80353f59dbc1d39e5 Mon Sep 17 00:00:00 2001
From: Felix Weiglhofer <weiglhofer@fias.uni-frankfurt.de>
Date: Fri, 9 Jun 2023 16:13:46 +0000
Subject: [PATCH] StsReadoutConfigLegacy: Fix out-of-bounds read on map
 creation.

---
 algo/detectors/sts/StsReadoutConfigLegacy.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/algo/detectors/sts/StsReadoutConfigLegacy.cxx b/algo/detectors/sts/StsReadoutConfigLegacy.cxx
index 34f41eaef2..d700304c2c 100644
--- a/algo/detectors/sts/StsReadoutConfigLegacy.cxx
+++ b/algo/detectors/sts/StsReadoutConfigLegacy.cxx
@@ -161,10 +161,10 @@ namespace cbm::algo
           int16_t feb      = elink2Feb[elinkId];               // FEB within CROB
           if (feb != -1) {
             int16_t module = feb2module[comp][crob][feb];  // Module index
-            moduleAddress  = modAddress[module];
 
             if (module != -1) {
               assert(module < numModules);
+              moduleAddress      = modAddress[module];
               bool moduleType    = modType[module];                               // 0 or 1
               int16_t moduleSide = feb2moduleSide[comp][crob][feb];               // 0 or 1, -1 is inactive
               int16_t febType    = (moduleType == 0 ? moduleSide : !moduleSide);  // 0 = FEB A, 1 = FEB B
-- 
GitLab