]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
In AliMpMotifReader, AliMpSectorReader:
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 27 Sep 2010 16:51:49 +0000 (16:51 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 27 Sep 2010 16:51:49 +0000 (16:51 +0000)
Fixing TAINTED_SCALAR defects reported by Coverity

MUON/mapping/AliMpMotifReader.cxx
MUON/mapping/AliMpSectorReader.cxx

index 0ee7a8672a553683324e48c9b9961c259db9893b..d1e8d811c835ac749d0a490366de64f12314fec0 100644 (file)
@@ -142,6 +142,10 @@ AliMpMotifType* AliMpMotifReader::BuildMotifType(const TString& motifTypeId)
         Fatal("BuildMotifType","Berg number > 80 ...");
         continue;
     }
+    if ( bergNum <= 0 || bergNum >= 101 ) {
+      AliErrorStream() << "Wrong bergNum: " << bergNum << endl;
+      return 0;
+    }  
     gassiChannel[bergNum-1]= atoi(gcStr);
   }
   
index 6e721410c67d69f886533da44905425224e791c7..d244754f66baaee110538350906679982cd20ade 100755 (executable)
@@ -111,7 +111,7 @@ void  AliMpSectorReader::ReadSectorData(istream& in)
   AliDebugStream(2) << keyword << endl;
 
   if (keyword != fgkSectorKeyword) {
-     Fatal("ReadSectorData", "Wrong file format.");
+     AliErrorStream() << "Wrong file format." << endl;
      return;
   }   
     
@@ -128,6 +128,11 @@ void  AliMpSectorReader::ReadSectorData(istream& in)
   direction = (directionStr == "Y") ? AliMp::kY  :  AliMp::kX;
 
   AliDebugStream(2) << nofZones << " " <<  nofRows << endl;
+  
+  if ( nofZones < 0 || nofRows < 0 ) {
+    AliErrorStream() << "Wrong nofZones/nofRows value." << endl;
+    return;
+  }         
 
   fSector = new AliMpSector("Not defined", nofZones, nofRows,direction,
                             offsetX, offsetY);
@@ -136,7 +141,7 @@ void  AliMpSectorReader::ReadSectorData(istream& in)
   in >> nextKeyword;
     
   if (nextKeyword != fgkZoneKeyword) {
-     Fatal("ReadSectorData", "Wrong file format.");
+     AliErrorStream() << "Wrong file format." << endl;
      return;
   }      
   
@@ -165,7 +170,7 @@ void AliMpSectorReader::ReadZoneData(istream& in)
   in >> nextKeyword;
     
   if (nextKeyword != fgkSubZoneKeyword) {
-     Fatal("ReadZoneData", "Wrong file format.");
+     AliErrorStream() << "Wrong file format." << endl;
      return;
   }  
     
@@ -188,7 +193,7 @@ void AliMpSectorReader::ReadSubZoneData(istream& in, AliMpZone* zone)
   in >> nextKeyword;
     
   if (nextKeyword != fgkRowKeyword) {
-     Fatal("ReadSubZoneData", "Wrong file format.");
+     AliErrorStream() << "Wrong file format." << endl;
      return;
   }  
     
@@ -290,7 +295,7 @@ void AliMpSectorReader::ReadRowSegmentsData(istream& in,
     ReadSubZoneData(in, zone);
   }   
   else {
-    Fatal("ReadRowSegmentsData", "Wrong file format.");
+    AliErrorStream() << "Wrong file format." << endl;
   } 
 }   
 
@@ -306,7 +311,7 @@ void AliMpSectorReader::ReadSectorSpecialData(istream& in, AliMp::XDirection dir
   AliDebugStream(2) << keyword << endl;
 
   if (keyword != fgkSectorSpecialKeyword) {
-     Fatal("ReadSectorSpecialData", "Wrong file format.");
+     AliErrorStream() << "Wrong file format." << endl;
      return;
   }   
 
@@ -316,7 +321,7 @@ void AliMpSectorReader::ReadSectorSpecialData(istream& in, AliMp::XDirection dir
   AliDebugStream(2) << keyword << endl;
     
   if (nextKeyword != fgkMotifKeyword) {
-    Fatal("ReadSectorSpecialData", "Wrong file format.");
+    AliErrorStream() << "Wrong file format." << endl;
     return;
   }  
 
@@ -346,7 +351,7 @@ void AliMpSectorReader::ReadMotifsSpecialData(istream& in)
   while (nextKeyword == fgkMotifKeyword);
     
   if (nextKeyword != fgkRowSpecialKeyword) {
-     Fatal("ReadMotifSpecialData", "Wrong file format.");
+     AliErrorStream() << "Wrong file format." << endl;
      return;
   }      
 }  
@@ -390,7 +395,7 @@ void AliMpSectorReader::ReadRowSpecialData(istream& in, AliMp::XDirection direct
   AliDebugStream(2) << nextKeyword << endl;
     
   if (nextKeyword != fgkPadRowsKeyword) {
-     Fatal("ReadRowSpecialData", "Wrong file format.");
+     AliErrorStream() << "Wrong file format." << endl;
      return;
   }  
     
@@ -425,13 +430,18 @@ void AliMpSectorReader::ReadRowSegmentSpecialData(istream& in,
   
   AliDebugStream(2) << nofPadRows << endl;
   
+  if ( nofPadRows < 0 ) {
+    AliErrorStream() << "Wrong nofPadRows value." << endl;
+    return;
+  }         
+
   TString keyword;
   in >> keyword;
 
   AliDebugStream(2) << keyword << endl;
     
   if (keyword != fgkPadRowSegmentKeyword) {
-     Fatal("ReadRowSegmentSpecialData", "Wrong file format.");
+     AliErrorStream() << "Wrong file format." << endl;
      return;
   }  
   
@@ -483,7 +493,7 @@ void AliMpSectorReader::ReadRowSegmentSpecialData(istream& in,
       AliMpVMotif* motif = fSector->GetMotifMap()->FindMotif(motifId);
       
       if (!motif) {
-        Fatal("ReadRowSegmentSpecialData", "Unknown motif.");
+        AliErrorStream() << "Unknown motif" << endl;
        return;
       }
 
@@ -503,7 +513,7 @@ void AliMpSectorReader::ReadRowSegmentSpecialData(istream& in,
     ReadRowSpecialData(in, direction);
   }   
   else {
-    Fatal("ReadRowSegmentSpecialData", "Wrong file format.");
+    AliErrorStream() << "Wrong file format." << endl;
   } 
 }