Skip to content

Commit

Permalink
UBSAN][VirtualJetProducer]Avoid creating vector of size zero for jets==1
Browse files Browse the repository at this point in the history
  • Loading branch information
smuzaffar committed Nov 1, 2024
1 parent 0205e9f commit baacf9d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion RecoJets/JetProducers/plugins/VirtualJetProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ void VirtualJetProducer::writeJets(edm::Event& iEvent, edm::EventSetup const& iS
if (!fjJets_.empty()) {
// Distance between jet centers and overlap area -- for disk-based area calculation
using RIJ = std::pair<double, double>;
std::vector<RIJ> rijStorage(fjJets_.size() * (fjJets_.size() / 2));
std::vector<RIJ> rijStorage(fjJets_.size() == 1 ? 1 : fjJets_.size() * (fjJets_.size() >> 1));
std::vector<RIJ*> rij(fjJets_.size());
unsigned int k = 0;
for (unsigned int ijet = 0; ijet < fjJets_.size(); ++ijet) {
Expand Down

0 comments on commit baacf9d

Please sign in to comment.