Skip to content

MONGOCRYPT-432 always initialize out and key_id_out#1154

Merged
kevinAlbs merged 2 commits intomongodb:masterfrom
kevinAlbs:coverity.MONGOCRYPT-432
May 1, 2026
Merged

MONGOCRYPT-432 always initialize out and key_id_out#1154
kevinAlbs merged 2 commits intomongodb:masterfrom
kevinAlbs:coverity.MONGOCRYPT-432

Conversation

@kevinAlbs
Copy link
Copy Markdown
Collaborator

Summary

Initialize out-params in _mongocrypt_key_broker_decrypted_key_by_id and _mongocrypt_key_broker_decrypted_key_by_name on error.

Details

Addresses Coverity issue with CID 202881.

_mongocrypt_key_broker_decrypted_key_by_(id|name) documents outputs are: "always initialized, even on error". This does not match the implementation. Changes MONGOCRYPT-432 expect the initialization.

IMO this is a low-severity issue, but worth fixing to match internal documentation. Since the only case an early return would occur is if the functions are called on an incorrect state. I expect that would only be triggered by a libmongocrypt bug (not user code).

kevinAlbs added 2 commits May 1, 2026 08:01
Resolves Coverity issue with CID: 202881. Matches documentation of `_mongocrypt_key_broker_decrypted_key_by_name`
@kevinAlbs kevinAlbs marked this pull request as ready for review May 1, 2026 12:25
@kevinAlbs kevinAlbs requested a review from a team as a code owner May 1, 2026 12:25
@kevinAlbs kevinAlbs requested a review from rcsanchez97 May 1, 2026 12:25
@kevinAlbs kevinAlbs removed the request for review from rcsanchez97 May 1, 2026 13:46
@kevinAlbs kevinAlbs merged commit 9e2bdaf into mongodb:master May 1, 2026
52 of 54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants