[SERVER-34640] Coverity analysis defect 103539: Using invalid iterator Created: 24/Apr/18  Updated: 27/Oct/23  Resolved: 27/Apr/18

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

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Backlog - Storage Execution Team
Resolution: Works as Designed Votes: 0
Labels: coverity
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Storage Execution
Operating System: ALL
Participants:

 Description   

An invalid or past-the-end iterator is being used

Defect 103539 (STATIC_C)
Checker INVALIDATE_ITERATOR (subcategory none)
File: /src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp
Function mongo::EphemeralForTestRecordStore::recordFor(const mongo::RecordId &)
/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp, line: 319
Function "end" creates an iterator.

        if (it == _data->records.end()) {

/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp, line: 319
"it" testing equal to "this->_data->records.end()".

        if (it == _data->records.end()) {

/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp, line: 324
Dereferencing iterator "it" though it is already past the end of its container.

        return &it->second;



 Comments   
Comment by Eric Milkie [ 27/Apr/18 ]

Coverity misdiagnosis.

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