BlockBasedInterleavedDecompress::DecodingState::Decoder64 default constructor leaves scaleIndex uninitialized

XMLWordPrintableJSON

    • 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_interleaved.h, struct `Decoder64` (nested within `BlockBasedInterleavedDecompress::DecodingState`) has a default constructor `Decoder64() = default;` which does not initialize `scaleIndex` (a raw `uint8_t`), which has no default member initializer. A default-constructed instance therefore holds an indeterminate `scaleIndex`.

      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, 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_interleaved.h:233 may not initialize class members of 'mongo::bsoncolumn::BlockBasedInterleavedDecompress::DecodingState::Decoder64'. Following members aren't initialized: scaleIndex."

      Suggested fix: initialize `scaleIndex` in the default constructor or add a default member initializer (e.g., `uint8_t scaleIndex = 0;`).

            Assignee:
            Binh Vo
            Reporter:
            Петя Вдовин (EXT)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: