Nate Lust discovered an invalid read in afw::math::makeInterpolate by running valgrind on a test for PSFEx.
==23324== Invalid read of size 8
|
==23324== at 0x1B09ACE4: lsst::afw::math::makeInterpolate(std::vector<double, std::allocator<double> > const&, std::vector<double, std::allocator<double> > const&, lsst::afw::math::Interpolate::Style) (Interpolate.cc:74)
|
==23324== by 0x1B0A9B16: lsst::afw::math::BackgroundMI::_setGridColumns(lsst::afw::math::Interpolate::Style, lsst::afw::math::UndersampleStyle, int, std::vector<int, std::allocator<int> > const&) const (BackgroundMI.cc:168)
|
==23324== by 0x1B0AC7A9: boost::shared_ptr<lsst::afw::image::Image<float> > lsst::afw::math::BackgroundMI::doGetImage<float>(lsst::afw::geom::Box2I const&, lsst::afw::math::Interpolate::Style, lsst::afw::math::UndersampleStyle) const (BackgroundMI.cc:339)
|
==23324== by 0x1B0AA0E8: lsst::afw::math::BackgroundMI::_getImage(lsst::afw::geom::Box2I const&, lsst::afw::math::Interpolate::Style, lsst::afw::math::UndersampleStyle, float) const (BackgroundMI.cc:453)
|
On inspection, the loop is running off the end of the array: when i = x.size() - 1 (i.e., the last element), then it's trying to access x[i+1], which is off the end.