[SERVER-60596] Replace boost::optional::get() with boost::optional::value in DensifyValue to avoid undefined behavior Created: 11/Oct/21 Updated: 29/Oct/23 Resolved: 12/Oct/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 5.3.0, 5.1.0-rc1 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Davis Haupt (Inactive) | Assignee: | Davis Haupt (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 | ||||||||
| Backport Requested: |
v5.1
|
||||||||
| Participants: | |||||||||
| Linked BF Score: | 115 | ||||||||
| Description |
|
boost::optional::get() has undefined behavior without checking if the optional exists with has_value() first. We are already switching on the underlying type of the variant _value, so if we want to throw an assertion if the invariant that the densify value and the densify unit are different, we should switch to boost::optional::value() in those cases. |
| Comments |
| Comment by Githook User [ 15/Oct/21 ] |
|
Author: {'name': 'Davis Haupt', 'email': 'davis.haupt@mongodb.com', 'username': 'davish'}Message: |
| Comment by Githook User [ 12/Oct/21 ] |
|
Author: {'name': 'Davis Haupt', 'email': 'davis.haupt@mongodb.com', 'username': 'davish'}Message: |