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

_fle2_insert_encryptionInformation raises Valgrind errors on bson_t

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • 1.8.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Not Needed

      In _fle2_insert_encryptionInformation in mongocrypt-ctx-encrypt.c, a Valgrind memory leak can occur when the libbson BSON_MEMCHECK compile flag is set because:

      1. bson_t explain is initialized on line 222 (as of commit 073a95) but is then passed as the dst argument to bson_copy_to on line 275 which requires that dst be uninitialized to avoid leaking memory (documentation)
      2. bson_t out is initialized on line 221, but if the goto success statement on line 246 is hit, then out never gets bson_destroy-ed before the function exits

            Assignee:
            kyle.kloberdanz@mongodb.com Kyle Kloberdanz (Inactive)
            Reporter:
            zachary.espiritu@mongodb.com Zachary Espiritu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: