[SERVER-63463] Audit how bitcastTo() and bitcastFrom() convert from unsigned to signed Created: 09/Feb/22  Updated: 10/Feb/22  Resolved: 10/Feb/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Drew Paroski Assignee: Drew Paroski
Resolution: Won't Do Votes: 0
Labels: sbe
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Sprint: QE 2022-02-21
Participants:

 Description   

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.


Generated at Thu Feb 08 05:57:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.