Skip to content

Resolve ATLASRECTS-5607 by fixing segmentation fault in GlobalChi2Fitter

Issue ATLASRECTS-5607 describes a segmentation violation that can occur in relatively rare cases due to an error on my part in merge request !35388 (merged). The specific error was due to a lack of knowledge on my part about the memory ownership properties of the IMaterialEffectsUpdator interface. The way this interface works is a little counter-intuitive and can break on smart pointer-based call sites if the developer does not take special care to handle pointer aliasing.

What happened here is that the updator returned a raw pointer aliasing a smart pointer at the call site, and in some specific cases this would result in segmentation faults as memory would be accesed that was freed by the RAII mechanisms of those smart pointers. There was also a risk of double frees, but this bug never seemed to naterialize because the code would segfault earlier trying to dereference the now-freed pointer.

I opened another issue, ATLASRECTS-5609, to suggest changes to said interface that makes it harder (or rather, near impossible) for developers working with smart pointers to make this same mistake. In addition, I have left comments in the code warning future developers of the GlobalChi2Fitter of this issue.

Closes ATLASRECTS-5607.

Merge request reports