]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Additional protection
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 Sep 2009 20:32:07 +0000 (20:32 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 Sep 2009 20:32:07 +0000 (20:32 +0000)
TRD/AliTRDSignalIndex.cxx

index 32e7cc7ae1f926e829df111aa3857392207fe429..9a763e9c7414e20e3f425e41d3b0c5fcf8bbf1f5 100644 (file)
@@ -329,14 +329,16 @@ void AliTRDSignalIndex::AddIndexRC(const Int_t row, const Int_t col)
   // This is to be used in the TRD clusterizer!
   //
 
-  if (row * col + 1 >= fMaxLimit) {
-    AliError(Form("Out-of-limits row * col %d. Limit is: %d"
-                 ,row * col
+  Int_t index = row*fNcols + col;
+
+  if ( index >= fMaxLimit || index < 0 ) {
+    AliError(Form("Out-of-limits index %d. Limit is: %d"
+                 ,index
                  ,fMaxLimit));
     return;
   }
  
-  fBoolIndex[row*fNcols+col]=kTRUE;
+  fBoolIndex[index]=kTRUE;
 
   fHasEntry = kTRUE;
 
@@ -425,8 +427,20 @@ void AliTRDSignalIndex::InitSortedIndex()
   for(int row = 0; row < fNrows; row++)
     for(int col = 0; col < fNcols; col++)
       if(IsBoolIndex(row, col)){
+       if (pos>=2*fMaxLimit || pos < 0) {
+         AliError(Form("Out-of-limits pos %d. Limit is: %d"
+                       ,pos
+                       ,2*fMaxLimit));
+         return;
+       }
        fSortedIndex[pos] = row;
        pos++;
+       if (pos>=2*fMaxLimit || pos < 0) {
+         AliError(Form("Out-of-limits pos %d. Limit is: %d"
+                       ,pos
+                       ,2*fMaxLimit));
+         return;
+       }
        fSortedIndex[pos] = col;
        pos++;
       }