[SERVER-15047] Timestamp class relies on undefined behavior Created: 26/Aug/14 Updated: 19/Sep/15 Resolved: 08/Apr/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code, Replication |
| Affects Version/s: | None |
| Fix Version/s: | 3.1.2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Andrew Morrow (Inactive) | Assignee: | Eric Milkie |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Operating System: | ALL |
| Participants: |
| Description |
|
The OpTime class assumes that it can dereference a casted pointer to its first uint32_t data member and read both data members out as a combined uint64_t. This is undefined behavior and is an aliasing violation. In addition, OpTime has a specified memory ordering but does not use endian conversion primitives to ensure that it is properly serialized when written to the network or stable storage. |
| Comments |
| Comment by Githook User [ 09/Apr/15 ] |
|
Author: {u'username': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}Message: Revert " This reverts commit e87716a9286b6aa6f63a513012e55f6e42f634a2. |
| Comment by Githook User [ 08/Apr/15 ] |
|
Author: {u'username': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}Message: |
| Comment by Eric Milkie [ 06/Apr/15 ] |
|
Class being renamed to "Timestamp"; still has aliasing/endian problems. To be fixed with this work ticket. |