[SERVER-68238] Coverity analysis defect 123341: Pointer to local outside scope Created: 22/Jul/22  Updated: 29/Oct/23  Resolved: 17/Aug/22

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

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Sanika Phanse (Inactive)
Resolution: Fixed Votes: 0
Labels: coverity, sharding-nyc-subteam3, txn-api-improvements
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 2022-08-08, Sharding 2022-08-22
Participants:

 Description   

Pointer to local outside scope

Dereferencing the returned or out-of-scope stack pointer will access an invalid location on the stack after its scope or after the function returns. Pointer to a local stack variable returned or used outside scope
/src/mongo/db/internal_session_pool.cpp:103: RETURN_LOCAL 123341 Address of temporary holding "mongo::LogicalSessionId(mongo::makeSystemLogicalSessionId())".
/src/mongo/db/internal_session_pool.cpp:103: RETURN_LOCAL 123341 Assigning: "systemUserDigest" = "mongo::LogicalSessionId(mongo::makeSystemLogicalSessionId()).getUid()".
/src/mongo/db/internal_session_pool.cpp:103: RETURN_LOCAL 123341 Temporary variable of type "mongo::LogicalSessionId" goes out of scope.
/src/mongo/db/internal_session_pool.cpp:104: RETURN_LOCAL 123341 Using "systemUserDigest", which points to an out-of-scope temporary variable of type "mongo::LogicalSessionId".


Generated at Thu Feb 08 06:10:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.