-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Storage Execution
-
ALL
-
Storage Execution 2026-08-03
-
None
-
None
-
None
-
None
-
None
-
None
-
None
In src/mongo/bson/bsoncolumn.h, the default constructor `Decoder64() = default;` initializes only members with default member initializers and does not initialize `scaleIndex` (a raw `uint8_t`), which has no default member initializer. A default-constructed instance therefore holds an indeterminate `scaleIndex`.
The `scaleIndex` member is used internally by `Decoder64` during BSONColumn materialization. Reading the indeterminate value before explicit assignment constitutes undefined behavior. While the practical impact may be limited if the member is always set before use in practice, the uninitialized read remains UB and should be fixed to ensure code correctness and eliminate static analysis warnings.
Found by static analysis (Svace, UNINIT.CTOR): "Constructor declared at bsoncolumn.h:350 may not initialize class members of 'mongo::BSONColumn::Iterator::DecodingState::Decoder64'. Following members aren't initialized: scaleIndex."
Suggested fix: initialize `scaleIndex` in the default constructor (e.g., `Decoder64() : scaleIndex(0) {}`) or give it a default member initializer (`uint8_t scaleIndex = 0;`).
- is related to
-
SERVER-131580 Turn on clang tidy check for uninitialized variable
-
- Backlog
-
- related to
-
SERVER-130953 BlockBasedInterleavedDecompress::DecodingState::Decoder64 default constructor leaves scaleIndex uninitialized
-
- Open
-
-
SERVER-130954 PoolForHost default constructor leaves _socketTimeoutSecs uninitialized
-
- Needs Scheduling
-
-
SERVER-130955 ReplicaSetMonitorManager default constructor leaves _numMonitorsCreated uninitialized
-
- Needs Scheduling
-