Fix potential out-of-bounds access in TimeFilter (#2532)

This commit is contained in:
Paul Romano 2023-06-11 15:05:16 -05:00 committed by GitHub
parent 610a5d8c34
commit bc4e95127c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -80,10 +80,11 @@ void TimeFilter::get_all_bins(
if (t_end < bins_[i_bin + 1])
break;
}
} else {
} else if (t_end < bins_.back()) {
// -------------------------------------------------------------------------
// For collision estimator or surface tallies, find a match based on the
// exact time of the particle
const auto i_bin = lower_bound_index(bins_.begin(), bins_.end(), t_end);
match.bins_.push_back(i_bin);
match.weights_.push_back(1.0);