[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 "SERVER-15047 Remove undefined behavior from Timestamp"

This reverts commit e87716a9286b6aa6f63a513012e55f6e42f634a2.
Branch: master
https://github.com/mongodb/mongo/commit/48f14493a3751483b67144897a44ed3297720f8c

Comment by Githook User [ 08/Apr/15 ]

Author:

{u'username': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}

Message: SERVER-15047 Remove undefined behavior from Timestamp
Branch: master
https://github.com/mongodb/mongo/commit/e87716a9286b6aa6f63a513012e55f6e42f634a2

Comment by Eric Milkie [ 06/Apr/15 ]

Class being renamed to "Timestamp"; still has aliasing/endian problems. To be fixed with this work ticket.

Generated at Thu Feb 08 03:36:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.