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

DocumentSourceSkip can overflow a long long when combining with adjacent skips

    • Fully Compatible
    • ALL
    • v3.6, v3.4

      During optimization, $skip will combine itself with an adjacent $skip, and the new value to skip is the sum of the two. However, the addition is performed without overflow checking. The skip value is stored as a long long, which means that we hit undefined behavior in the event of overflow.

      The unsafe code is in DocumentSourceSkip::doOptimizeAt() in v3.6 and v3.4.

            Assignee:
            charlie.swanson@mongodb.com Charlie Swanson
            Reporter:
            kyle.suarez@mongodb.com Kyle Suarez
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: