[SERVER-47357] `fmt::formatter<HostAndPort>::format` returns wrong iterator Created: 06/Apr/20 Updated: 29/Oct/23 Resolved: 07/Apr/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | 4.4.0-rc0, 4.7.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Billy Donahue | Assignee: | Billy Donahue |
| 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.4
|
||||||||
| Sprint: | Service arch 2020-04-20 | ||||||||
| Participants: | |||||||||
| Description |
|
`fmt::formatter::format` writes into and advances an output iterator obtained by `ctx.out()`. It has to return the advanced output iterator. But we return the `ctx.out()`, not the copy we advanced. This yielded UB in a toolchain validation build against mongo 4.2 on [https://logkeeper.mongodb.org/lobster/build/24a6f9b5ad70e8fbfc9bed6e0ccf388e/test/5e8a1e02be07c446740c1d7f#bookmarks=0%2C19%2C67 ]
|
| Comments |
| Comment by Billy Donahue [ 07/Apr/20 ] |
|
Author: {'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}Date: Mon Apr 6 12:53:35 2020 -0400 Message:
|
| Comment by Githook User [ 07/Apr/20 ] |
|
Author: {'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}Message: |
| Comment by Billy Donahue [ 06/Apr/20 ] |
|
discovered while upgrading toolchain in BUILD-10181 |
| Comment by Billy Donahue [ 06/Apr/20 ] |