summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2019-04-06 08:24:23 -0400
committerBenety Goh <benety@mongodb.com>2019-04-06 08:24:38 -0400
commit7a196636445fea6318b22c962b90b2a901a28edd (patch)
tree28a2f71d91f0debb521da6c07f538396e870ddac /src
parentff982a6935c99adebb637adec876c471f282fdc5 (diff)
downloadmongo-7a196636445fea6318b22c962b90b2a901a28edd.tar.gz
SERVER-39514 fix UUIDCatalog::next() to avoid advancing past end of map
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/catalog/uuid_catalog.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mongo/db/catalog/uuid_catalog.cpp b/src/mongo/db/catalog/uuid_catalog.cpp
index 9e83652c544..40f5863c32f 100644
--- a/src/mongo/db/catalog/uuid_catalog.cpp
+++ b/src/mongo/db/catalog/uuid_catalog.cpp
@@ -432,7 +432,8 @@ boost::optional<CollectionUUID> UUIDCatalog::next(StringData db, CollectionUUID
}
auto nextEntry = std::next(entry, 1);
- while (nextEntry->first.first == db && nextEntry->second->collectionPtr == nullptr) {
+ while (nextEntry != _orderedCollections.end() && nextEntry->first.first == db &&
+ nextEntry->second->collectionPtr == nullptr) {
nextEntry = std::next(nextEntry, 1);
}
// If the element was the last entry or is from a different database.