Uploaded image for project: 'Libmongocrypt'
  1. Libmongocrypt
  2. MONGOCRYPT-438

Error on encryption or decryption may result in memory leak

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.5.0-rc2, 1.5.0
    • Affects Version/s: 1.5.0-rc0
    • Component/s: None
    • None
    • Not Needed

      Error handling of _mongocrypt_transform_binary_in_bson does not free a possibly partially constructed BSON document for the final result. Example in mongocrypt-ctx-encrypt.c:

            bson_init (&converted);
            if (!_mongocrypt_transform_binary_in_bson (
                   _replace_marking_with_ciphertext,
                   &ctx->kb,
                   TRAVERSE_MATCH_MARKING,
                   &iter,
                   &converted,
                   ctx->status)) {
               return _mongocrypt_ctx_fail (ctx);
            }
      

      This is missing a call to bson_destroy (&converted) on error.

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: