Skip to content

Commit

Permalink
Fixed array overflow by ignoring the out-of-bounds value in Validatio…
Browse files Browse the repository at this point in the history
…n/EcalDigis.

Ignoring such values is ways better than modifying unrelated
variables on the stack.
  • Loading branch information
Dmitrijus Bugelskis committed Jun 9, 2015
1 parent ff7a105 commit 9d0eae2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Validation/EcalDigis/src/EcalSelectiveReadoutValidation.cc
Expand Up @@ -1378,7 +1378,13 @@ EcalSelectiveReadoutValidation::analyzeTP(edm::Event const & event,
double etSum = ttEtSums[iEta0][iPhi0];

int iE = meTp_->getTProfile()->FindFixBin(tpEt);
++tpEtCount[iE];
if ((iE >= 0) && (iE < 100)) {
++tpEtCount[iE];
} else {
// FindFixBin might return an overflow bin (outside tpEtCount range).
// To prevent a memory overflow / segfault, these values are ignored.
std::cout << "EcalSelectiveReadoutValidation: Invalid iE value: " << iE << std::endl;
}

fill(meTpVsEtSum_, etSum, tpEt);
++TTFlagCount[it->ttFlag()];
Expand Down

0 comments on commit 9d0eae2

Please sign in to comment.