[CDRIVER-2274] _mongoc_write_command_init() may freeze const mongoc_write_concern_t Created: 11/Sep/17  Updated: 22/Nov/17  Resolved: 09/Oct/17

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: 1.7.0
Fix Version/s: 1.9.0

Type: Bug Priority: Major - P3
Reporter: Jeremy Mikola Assignee: Jeremy Mikola
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by CDRIVER-2284 Invalidate generated BSON instead of ... Closed
Related
is related to CDRIVER-2273 Do not include default write concern ... Closed

 Description   

The WRITE_CONCERN_DOC() macro in mongoc-write-command.c casts a const mongoc_write_concern_t* to mongoc_write_concern_t* in order to call _mongoc_write_concern_get_bson(), which may modify the state of the write concern by freezing it.

It would be preferable if this used _BSON_APPEND_WRITE_CONCERN(), which makes a temporary copy of the write concern if it is not already frozen (thereby leaving a non-frozen write concern as-is).



 Comments   
Comment by Jeremy Mikola [ 09/Oct/17 ]

This is no longer an issue thanks to CDRIVER-2284, which will ensure that read and write concerns remain mutable after their get_bson() functions are called.

Generated at Wed Feb 07 21:14:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.