Skip to content

PatAlgorithms - Fix UB Sanitizer error in PatBBDTSeedClassifier

Addresses errors reported in the ubsan Brunel tests in the lhcb-sanitizer nightlies

https://lhcb-nightlies.cern.ch/nightly/lhcb-sanitizers/build/6/

e.g. from the 2016magup test

/workspace/build/GAUDI/GAUDI_HEAD/InstallArea/x86_64-centos7-gcc7-dbg+o1+ubsan/include/GaudiAlg/GaudiCommonImp.h:148:22: runtime error: cast to virtual base of address 0x00003b499720 which does not point to an object of type 'IPatMvaClassifier'
0x00003b499720: note: object has a possibly invalid vptr: abs(offset to top) too big
 20 7f 00 00  28 da 48 a6 20 7f 00 00  f1 01 00 00 00 00 00 00  f0 8d 04 47 21 7f 00 00  78 73 e1 02
              ^~~~~~~~~~~~~~~~~~~~~~~
              possibly invalid vptr
    #0 0x7f20a614b743 in IPatMvaClassifier* GaudiCommon<Algorithm>::tool<IPatMvaClassifier>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, IInterface const*, bool) const /workspace/build/GAUDI/GAUDI_HEAD/InstallArea/x86_64-centos7-gcc7-dbg+o1+ubsan/include/GaudiAlg/GaudiCommonImp.h:148
    #1 0x7f20a60e5ebb in PatLongLivedTracking::initialize() /workspace/build/REC/REC_HEAD/Tf/PatAlgorithms/src/PatLongLivedTracking.cpp:135

The issue was the tool was creating a huge (1M floats) array as a data member of the class, thus making its foot print very large. This MR simply uses a vector instead, thus moving the storage to the heap.

FYI @graven @adendek @decianm

Merge request reports