Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-15047

Timestamp class relies on undefined behavior

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.2
    • Affects Version/s: None
    • Component/s: Internal Code, Replication
    • Labels:
      None
    • Fully Compatible
    • ALL

      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.

            Assignee:
            milkie@mongodb.com Eric Milkie
            Reporter:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: