Skip to content

Commit

Permalink
Merge pull request #46907 from smuzaffar/ubsan-fix-HepMCProduct
Browse files Browse the repository at this point in the history
[UBSAN]Fix runtime error for invalid bool value assignment
  • Loading branch information
cmsbuild authored Jan 9, 2025
2 parents d288c81 + adae936 commit e944ebc
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions SimDataFormats/GeneratorProducts/src/HepMCProduct.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ void HepMCProduct::addHepMCData(HepMC::GenEvent* evt) {

void HepMCProduct::applyVtxGen(HepMC::FourVector const& vtxShift) {
//std::cout<< " applyVtxGen called " << isVtxGenApplied_ << endl;
//fTimeOffset = 0;

if (isVtxGenApplied())
return;
Expand Down Expand Up @@ -126,16 +125,14 @@ HepMCProduct::HepMCProduct(HepMCProduct const& other) : evt_(nullptr) {
isVtxGenApplied_ = other.isVtxGenApplied_;
isVtxBoostApplied_ = other.isVtxBoostApplied_;
isPBoostApplied_ = other.isPBoostApplied_;
//fTimeOffset = other.fTimeOffset;
}

// swap
void HepMCProduct::swap(HepMCProduct& other) {
std::swap(evt_, other.evt_);
std::swap(isVtxGenApplied_, other.isVtxGenApplied_);
std::swap(isVtxBoostApplied_, other.isVtxBoostApplied_);
std::swap(isPBoostApplied_, other.isPBoostApplied_);
//std::swap(fTimeOffset, other.fTimeOffset);
isVtxGenApplied_ = other.isVtxGenApplied_;
isVtxBoostApplied_ = other.isVtxBoostApplied_;
isPBoostApplied_ = other.isPBoostApplied_;
}

// assignment: use copy/swap idiom for exception safety.
Expand Down

0 comments on commit e944ebc

Please sign in to comment.