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

Timestamp class relies on undefined behavior

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 3.1.2
    • None
    • Internal Code, Replication
    • None
    • Fully Compatible
    • ALL

    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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: