Skip to content

Commit

Permalink
Merge pull request #35303 from trocino/fix_UBSAN_issue35036_MUO-MuIdProd
Browse files Browse the repository at this point in the history
Fix undefined behavior in MuonIdProducer from empty pointer
  • Loading branch information
cmsbuild authored Sep 16, 2021
2 parents 05ef5e0 + 2577c56 commit e7caccc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

class MuonShowerDigiFiller {
public:
MuonShowerDigiFiller() {}
MuonShowerDigiFiller(const edm::ParameterSet&, edm::ConsumesCollector&& iC);

void getES(const edm::EventSetup& iSetup);
Expand Down
4 changes: 3 additions & 1 deletion RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ MuonIdProducer::MuonIdProducer(const edm::ParameterSet& iConfig)
if (fillShowerDigis_ && fillMatching_) {
edm::ParameterSet showerDigiParameters = iConfig.getParameter<edm::ParameterSet>("ShowerDigiFillerParameters");
theShowerDigiFiller_ = std::make_unique<MuonShowerDigiFiller>(showerDigiParameters, consumesCollector());
} else {
theShowerDigiFiller_ = std::make_unique<MuonShowerDigiFiller>(); // to be used to call fillDefault only
}

if (fillCaloCompatibility_) {
Expand Down Expand Up @@ -888,7 +890,7 @@ void MuonIdProducer::fillMuonId(edm::Event& iEvent,

matchedChamber.id = chamber.id;

if (fillShowerDigis_) {
if (fillShowerDigis_ && fillMatching_) {
theShowerDigiFiller_->fill(matchedChamber);
} else {
theShowerDigiFiller_->fillDefault(matchedChamber);
Expand Down

0 comments on commit e7caccc

Please sign in to comment.