- 
    Type:Bug 
- 
    Resolution: Unresolved
- 
    Priority:Major - P3 
- 
    None
- 
    Affects Version/s: None
- 
    Component/s: None
- 
    None
- 
        Not Needed
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
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.
- is cloned by
- 
                    MONGOCRYPT-243 libmongocrypt segfaults if a handle is used without init being called on it -         
- Backlog
 
-         
- related to
- 
                    MONGOCRYPT-241 libmongocrypt uses asserts and terminates application processes -         
- Backlog
 
-