Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-8861

GeoSearch::expandEndPoints can elicit --multiset::begin()

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.0
    • Affects Version/s: 2.4.0-rc2
    • Component/s: None
    • ALL

      In GeoSearch::expandEndPoints there is an iterator decrement that can synthesize an iterator equivalent to --multiset::begin():

      https://github.com/mongodb/mongo/blob/18de1d56412bfb89a6b3f95b18eeb770184fda15/src/mongo/db/geo/2d.cpp#L1823

      This is illegal in C+11 even if the iterator is never dereferenced since one of the prerequisites for operator--() on a BidirectionalIterator 'r' is that there exists 's' such that r == ++s, and there is no such 's' for r == begin() [24.2.6]. This causes a crash when mongo is built against libc+.

      Need to check C++98 to know for sure that this is illegal there (I'd guess it is), but it seems safer to not form the potentially illegal iterator anyway.

            Assignee:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Reporter:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: