Fixing check for buffer overflow.
authorszostak <szostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 25 Sep 2007 09:21:34 +0000 (09:21 +0000)
committerszostak <szostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 25 Sep 2007 09:21:34 +0000 (09:21 +0000)
HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructor.cxx

index af52fda..3d09bc4 100644 (file)
@@ -443,6 +443,12 @@ bool AliHLTMUONTriggerReconstructor::FindTrigHits()
        // and collect all the ones that belong to a given trigger record.
        while (hitInfo.size() > 0)
        {
+               // Must check if we have not overflowed the buffer.
+               if((*fRecPointsCount) == fMaxRecPointsCount){
+                       HLTError("Nof RecHit (i.e. %d) exceeds the max nof RecHit limit %d\n",(*fRecPointsCount),fMaxRecPointsCount);
+                       return false;
+               }
+       
                bool hitset[4] = {false, false, false, false};
                
                // Choose the current trigger record we are collecting hits for.
@@ -491,10 +497,6 @@ bool AliHLTMUONTriggerReconstructor::FindTrigHits()
                
                // Increment the counter for the number of trigger records found.
                (*fRecPointsCount)++;
-               if((*fRecPointsCount) == fMaxRecPointsCount){
-                       HLTFatal("Nof RecHit (i.e. %d) exceeds the max nof RecHit limit %d\n",(*fRecPointsCount),fMaxRecPointsCount);
-                       return false;
-               }
        }
   
        hitInfo.clear();