Skip to content

Commit

Permalink
Merge pull request #1187 from JeffersonLab/aaust_analysis_loop_safe
Browse files Browse the repository at this point in the history
Safe-guard against int wrap-around
  • Loading branch information
jrstevenjlab authored Jul 27, 2018
2 parents c0aeeb0 + 09450e5 commit cd248aa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libraries/ANALYSIS/DSourceComboer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1690,6 +1690,9 @@ void DSourceComboer::Combo_WithBeam(const vector<const DReaction*>& locReactions
}

//Select beam particles
if (abs(locRFBunch) > 2000000000)
return; // proximity to INT_MAX can cause infinite loops, certainly no valid beam particle

auto locBeamParticles = dSourceComboTimeHandler->Get_BeamParticlesByRFBunch(locRFBunch, dMaxRFBunchCuts[locReactionVertexInfo]);
if(dDebugLevel > 0)
cout << "rf bunch, max #rf bunches, #beams = " << locRFBunch << ", " << dMaxRFBunchCuts[locReactionVertexInfo] << ", " << locBeamParticles.size() << endl;
Expand Down

0 comments on commit cd248aa

Please sign in to comment.