[SERVER-24806] Coverity analysis defect 99681: Pointer to local outside scope Created: 27/Jun/16  Updated: 08/Jan/24  Resolved: 27/Jun/16

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

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Charlie Swanson
Resolution: Done Votes: 0
Labels: coverity
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

Pointer to a local stack variable returned or used outside scope

Defect 99681 (STATIC_C)
Checker RETURN_LOCAL (subcategory none)
File: /src/mongo/db/pipeline/aggregation_request.cpp
Function mongo::AggregationRequest::parseFromBSON(mongo::NamespaceString, const mongo::BSONObj &)
/src/mongo/db/pipeline/aggregation_request.cpp, line: 75
Temporary variable of type "mongo::StringData const [6]" goes out of scope.

        const std::initializer_list<StringData> optionsParsedElseWhere = {

/src/mongo/db/pipeline/aggregation_request.cpp, line: 93
Using "optionsParsedElseWhere.begin()", which points to an out-of-scope temporary variable of type "mongo::StringData const [6]".

            if (std::find(optionsParsedElseWhere.begin(), optionsParsedElseWhere.end(), fieldName) !=



 Comments   
Comment by Charlie Swanson [ 27/Jun/16 ]

milkie yep, it looks like it. mira.carey@mongodb.com confirmed for me that the use of the '_sd' tag means it's a constexpr StringData, so the underlying string shouldn't be deleted.

Generated at Thu Feb 08 04:07:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.