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

Ensure that vector is initialized before setting vector as output of std::transform

    • Fully Compatible
    • ALL
    • Sharding 2020-10-19

      There are a few valid ways to output to a newly declared vector from std::transform. For example:

      1. Initialize the vector to the size of the input, so that std::transform can properly index into each memory space, OR
      2. Use std::back_inserter, which is an iterator that will call push_back on the output vector for each input element.

      If one attempts to use std::transform on an uninitialized vector without using std::back_inserter, std::transform will induce a segfault attempting to index into memory that hasn't yet been allocated.

      This ticket is to fix an instance of that bug in Resharding code.

            Assignee:
            blake.oler@mongodb.com Blake Oler
            Reporter:
            blake.oler@mongodb.com Blake Oler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: