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

BSONObjBuilder::asTempObj is not exception safe

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.3.1
    • Affects Version/s: 3.6.13, 4.0.10, 4.2.0-rc2
    • Component/s: Internal Code
    • Labels:
      None
    • Fully Compatible
    • ALL
    • v4.2, v4.0, v3.6
    • Dev Tools 2019-07-15, Dev Tools 2019-07-29

      If this line throws, e.g. due to the object we're trying to construct being too large, this leaves the BSONObjBuilder in a state where "_doneCalled" is true, which can later lead to this invariant being hit unexpectedly. We should either make this function exception-safe and reset the state of the BSONObjBuilder to how it was before calling _done() in this line, if possible, and if not, we should update callers to be prepared for the possibility of this throwing.

            Assignee:
            adam.martin@mongodb.com ADAM Martin (Inactive)
            Reporter:
            matthew.saltz@mongodb.com Matthew Saltz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: