Prevent writeConcernError from going out of scope in DBDirectClient helpers

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.2.0-rc0, 8.1.1
    • 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
    • 3
    • 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
            Reporter:
            Allison Easton
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: