-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Networking & Observability
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
In src/mongo/client/connpool.h, class PoolForHost has a default constructor PoolForHost::PoolForHost() which does not initialize the _socketTimeoutSecs member (a raw double), which has no default member initializer, so a default-constructed instance holds an indeterminate _socketTimeoutSecs. This member is used in PoolForHost::clear() when logging dropped connections via _makeDuration(_socketTimeoutSecs), and reading the uninitialized value constitutes undefined behavior, potentially causing unexpected behavior or crashes if _socketTimeoutSecs is not set before clear() is called.
Found by static analysis (Svace, UNINIT.CTOR): "Constructor declared at connpool.cpp:104 may not initialize class members of 'mongo::PoolForHost'. Following members aren't initialized: _socketTimeoutSecs."
The fix is to add a default member initializer (double _socketTimeoutSecs = 0.0
or initialize it explicitly in the constructor initializer list.
- is related to
-
SERVER-130952 BSONColumn::Iterator::DecodingState::Decoder64 default constructor leaves scaleIndex uninitialized
-
- Open
-
-
SERVER-131580 Turn on clang tidy check for uninitialized variable
-
- Backlog
-