Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-3112

Invalid read in afw::math::Interpolate --- off-by-one bug

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: afw
    • Labels:
      None

      Description

      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.

        Attachments

          Issue Links

            Activity

            price Paul Price created issue -
            price Paul Price made changes -
            Field Original Value New Value
            Link This issue relates to DM-2961 [ DM-2961 ]
            price Paul Price made changes -
            Reviewers John Swinbank, Nate Lust [ swinbank, nlust ]
            Status To Do [ 10001 ] In Review [ 10004 ]
            swinbank John Swinbank made changes -
            Status In Review [ 10004 ] Reviewed [ 10101 ]
            swinbank John Swinbank made changes -
            Epic Link DM-1912 [ 15945 ]
            swinbank John Swinbank made changes -
            Sprint Science Pipelines DM-S15-5 [ 162 ]
            Story Points 0.25
            Issue Type Story [ 10001 ] Bug [ 1 ]
            price Paul Price made changes -
            Resolution Done [ 10000 ]
            Status Reviewed [ 10101 ] Done [ 10002 ]

              People

              Assignee:
              price Paul Price
              Reporter:
              price Paul Price
              Reviewers:
              John Swinbank, Nate Lust
              Watchers:
              John Swinbank, Nate Lust, Paul Price
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins Builds

                  No builds found.