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

libmongocrypt aborts when mongocrypt_ctx_decrypt_init is called with empty bson string

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      It appears that if mongocrypt_ctx_decrypt_init is called with an empty string as the bson buffer, the result is a BSON_ASSERT failure. In Ruby driver test suite this produces:

      (byebug) mongocrypt_ctx_decrypt_init(context.ctx_p, data_p)
      /data/mci/dd0591b7a0680c7f9aceb9cc30394457/libmongocrypt/src/mongocrypt-buffer.c:38 _make_owned(): precondition failed: buf->data
      

      I also wrote a C program at https://github.com/p-mongo/tests/blob/master/lmc-empty-bson/test-empty-bson.c which produces:

      speed% ./test-empty-bson 
      /data/mci/b36facda8d87bede21e55b88e924c257/libmongocrypt/src/mongocrypt-buffer.c:38 _make_owned(): precondition failed: buf->data
      zsh: abort      ./test-empty-bson
       
       
      
      

      libmongocrypt should handle empty bson string in a more graceful way, such as by returning an ordinary error to the caller in this case.

      Attachments

        Activity

          People

            Unassigned Unassigned
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: