[SERVER-44281] Coverity analysis defect 101249: Using invalid iterator Created: 28/Oct/19  Updated: 29/Oct/23  Resolved: 28/Oct/19

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 4.3.1

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

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Dev Tools 2019-11-04
Participants:

 Description   

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

Defect 101249 (STATIC_C)
Checker INVALIDATE_ITERATOR (subcategory none)
File: /src/mongo/util/options_parser/value.cpp
Function _ZNK5mongo17optionenvironment5Value8toStringB5cxx11Ev
/src/mongo/util/options_parser/value.cpp, line: 223
Function "end" creates an iterator.

                    sb << _stringMapVal.end()->first << ":" << _stringMapVal.end()->second;

/src/mongo/util/options_parser/value.cpp, line: 223
Dereferencing iterator "this->_stringMapVal.end()" though it is already past the end of its container.

                    sb << _stringMapVal.end()->first << ":" << _stringMapVal.end()->second;



 Comments   
Comment by Githook User [ 28/Oct/19 ]

Author:

{'name': 'Billy Donahue', 'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com'}

Message: SERVER-44281 Fix use of invalid end iterator
Branch: master
https://github.com/mongodb/mongo/commit/f377a2838361e27b95ab4667fbd367528dc56c28

Comment by Billy Donahue [ 28/Oct/19 ]

https://mongodbcr.appspot.com/516490028/

Generated at Thu Feb 08 05:05:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.