summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Edin <henrik.edin@mongodb.com>2021-05-14 08:48:47 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-05-24 14:25:29 +0000
commitf1806516ce775635d62254e615fd1a6a099acada (patch)
treeb4a2661cf5b79f305ff73c527153ce144a9cdd13
parent1a9a9b424d19c914118477bbd245bf3fbf96253d (diff)
downloadmongo-f1806516ce775635d62254e615fd1a6a099acada.tar.gz
SERVER-56836 SERVER-56837 Add self-assignment checks in MinMaxStore.
(cherry picked from commit 576bfe9b642f8cebf5060c6878a128c1b27ed1d0)
-rw-r--r--src/mongo/db/timeseries/minmax.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mongo/db/timeseries/minmax.cpp b/src/mongo/db/timeseries/minmax.cpp
index c15c8528d22..403c564b003 100644
--- a/src/mongo/db/timeseries/minmax.cpp
+++ b/src/mongo/db/timeseries/minmax.cpp
@@ -172,7 +172,9 @@ MinMaxStore::ObjView::ObjView(const MinMaxStore::Entries& entries,
: _entries(entries), _pos(pos) {}
MinMaxStore::ObjView& MinMaxStore::ObjView::operator=(const MinMaxStore::ObjView& rhs) {
- _pos = rhs._pos;
+ if (this != &rhs) {
+ _pos = rhs._pos;
+ }
return *this;
}
@@ -208,7 +210,9 @@ MinMaxStore::Obj::operator MinMaxStore::ObjView() {
}
MinMaxStore::Obj& MinMaxStore::Obj::operator=(const MinMaxStore::Obj& rhs) {
- _pos = rhs._pos;
+ if (this != &rhs) {
+ _pos = rhs._pos;
+ }
return *this;
}