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

Prevent writeConcernError from going out of scope in DBDirectClient helpers

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.2.0-rc0
    • Affects Version/s: 7.0.0, 8.1.0-rc0, 8.0.0, 8.2.0-rc0
    • Component/s: None
    • None
    • Catalog and Routing
    • Fully Compatible
    • ALL
    • v8.1, v8.0, v7.0
    • CAR Team 2025-04-14
    • 200
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In SERVER-52846, helpers were added to the dbdirect client to perform inserts, updates, and deletes more easily. In SERVER-81246 a writeConcernError was added to the WriteCommandReplyBase (which is included as part of the reply types of the dbDirectClient helpers. The writeConcernError is a bson object, and so when the dbDirectClient helpers parse the insert/delete/update reply, they are not taking ownership of the writeConcernError sub-object. This means that as soon as the insert/update/delete functions in the dbdirect client return, the writeConcernError is already out of scope, and any caller who attempts to check the write concern error will be accessing freed memory.

            Assignee:
            allison.easton@mongodb.com Allison Easton
            Reporter:
            allison.easton@mongodb.com Allison Easton
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              None
              None
              None
              None