summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/datetime
diff options
context:
space:
mode:
authorJames Wahlin <james@mongodb.com>2017-10-23 09:25:17 -0400
committerJames Wahlin <james@mongodb.com>2017-10-30 08:26:22 -0400
commit9becaec05921e0fd6eeb3e7bdf8c91ca1f6531c7 (patch)
treea5b3a2fd9c52eff5ff5bbc82f6801acbafdd9e08 /src/mongo/db/query/datetime
parentdb64381873afebf1532a0fd576499f72da00b703 (diff)
downloadmongo-9becaec05921e0fd6eeb3e7bdf8c91ca1f6531c7.tar.gz
SERVER-31664 Fix use after free of OperationContext by ExpressionDate*
Addresses the case where a time zone expression lives within a collection validator as part of a $expr expression. In this case, the Expression will outlive the OperationContext it was created under.
Diffstat (limited to 'src/mongo/db/query/datetime')
-rw-r--r--src/mongo/db/query/datetime/date_time_support.cpp1
-rw-r--r--src/mongo/db/query/datetime/date_time_support.h3
2 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/db/query/datetime/date_time_support.cpp b/src/mongo/db/query/datetime/date_time_support.cpp
index fc24dd22206..2b6cb8ec078 100644
--- a/src/mongo/db/query/datetime/date_time_support.cpp
+++ b/src/mongo/db/query/datetime/date_time_support.cpp
@@ -68,7 +68,6 @@ long long seconds(Date_t date) {
} // namespace
const TimeZoneDatabase* TimeZoneDatabase::get(ServiceContext* serviceContext) {
- invariant(getTimeZoneDatabase(serviceContext));
return getTimeZoneDatabase(serviceContext).get();
}
diff --git a/src/mongo/db/query/datetime/date_time_support.h b/src/mongo/db/query/datetime/date_time_support.h
index 9973a198939..9d5b3188abc 100644
--- a/src/mongo/db/query/datetime/date_time_support.h
+++ b/src/mongo/db/query/datetime/date_time_support.h
@@ -346,7 +346,8 @@ public:
};
/**
- * Returns the TimeZoneDatabase object associated with the specified service context.
+ * Returns the TimeZoneDatabase object associated with the specified service context or nullptr
+ * if none exists.
*/
static const TimeZoneDatabase* get(ServiceContext* serviceContext);