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

Audit how bitcastTo() and bitcastFrom() convert from unsigned to signed

    • Type: Icon: Task Task
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • QE 2022-02-21

      The C++ standard says the following about unsigned->signed conversions:

      "If the destination type is signed, the value is unchanged if it can be represented in the destination type (and bit-field width); otherwise, the value is implementation-defined."

      The goal of this task is to audit how bitcastTo() and bitcastFrom() convert from unsigned to signed, and to fix these functions as needed so that the convert from unsigned to signed in a manner that preserves the bit pattern (i.e. it should match how memcpy() would perform the conversion).

      It would also be good to scrutinize any signed to unsigned conversions performed within the implementations of bitcastTo() and bitcastFrom() and to make sure we're happy with how we're performing these conversions.

            Assignee:
            andrew.paroski@mongodb.com Drew Paroski
            Reporter:
            andrew.paroski@mongodb.com Drew Paroski
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: