[SERVER-41989] BSONObjBuilder::asTempObj is not exception safe Created: 27/Jun/19 Updated: 29/Oct/23 Resolved: 26/Jul/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | 3.6.13, 4.0.10, 4.2.0-rc2 |
| Fix Version/s: | 4.3.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Matthew Saltz (Inactive) | Assignee: | ADAM Martin (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||
| Backport Requested: |
v4.2, v4.0, v3.6
|
||||||||||||||||||||
| Sprint: | Dev Tools 2019-07-15, Dev Tools 2019-07-29 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||
| Description |
|
If this line throws, e.g. due to the object we're trying to construct being too large, this leaves the BSONObjBuilder in a state where "_doneCalled" is true, which can later lead to this invariant being hit unexpectedly. We should either make this function exception-safe and reset the state of the BSONObjBuilder to how it was before calling _done() in this line, if possible, and if not, we should update callers to be prepared for the possibility of this throwing. |
| Comments |
| Comment by Githook User [ 26/Jul/19 ] |
|
Author: {'name': 'ADAM David Alan Martin', 'username': 'adamlsd', 'email': 'adam.martin@10gen.com'}Message: The setting of `_doneCalled` too early allows for it to remain set |