diff options
author | Katherine Wu <katherine.wu@mongodb.com> | 2020-02-24 17:23:23 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-02-26 20:24:51 +0000 |
commit | 0b045c34c29cd03f730c4edc357da5043fecefea (patch) | |
tree | d155b89330f592cf2358f0ce5932dabee15ffcd6 /src/mongo/db/pipeline/variables.cpp | |
parent | 57f6385025adf630a410f9d658f61b5afd140121 (diff) | |
download | mongo-0b045c34c29cd03f730c4edc357da5043fecefea.tar.gz |
SERVER-46311 $$IS_MR and $$JS_SCOPE access crashes server
create mode 100644 jstests/aggregation/variables/runtime_constants.js
Diffstat (limited to 'src/mongo/db/pipeline/variables.cpp')
-rw-r--r-- | src/mongo/db/pipeline/variables.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/db/pipeline/variables.cpp b/src/mongo/db/pipeline/variables.cpp index 002c68d5cbc..21624f626a9 100644 --- a/src/mongo/db/pipeline/variables.cpp +++ b/src/mongo/db/pipeline/variables.cpp @@ -40,12 +40,8 @@ namespace mongo { constexpr Variables::Id Variables::kRootId; constexpr Variables::Id Variables::kRemoveId; -const StringMap<Variables::Id> Variables::kBuiltinVarNameToId = {{"ROOT", kRootId}, - {"REMOVE", kRemoveId}, - {"NOW", kNowId}, - {"CLUSTER_TIME", kClusterTimeId}, - {"JS_SCOPE", kJsScopeId}, - {"IS_MR", kIsMapReduceId}}; +const StringMap<Variables::Id> Variables::kBuiltinVarNameToId = { + {"ROOT", kRootId}, {"REMOVE", kRemoveId}, {"NOW", kNowId}, {"CLUSTER_TIME", kClusterTimeId}}; void Variables::uassertValidNameForUserWrite(StringData varName) { // System variables users allowed to write to (currently just one) @@ -154,6 +150,10 @@ Value Variables::getValue(Id id, const Document& root) const { str::stream() << "Builtin variable '$$" << getBuiltinVariableName(id) << "' is not available"); MONGO_UNREACHABLE; + case Variables::kJsScopeId: + uasserted(4631100, "Use of undefined variable '$$JS_SCOPE'."); + case Variables::kIsMapReduceId: + uasserted(4631101, "Use of undefined variable '$$IS_MR'."); default: MONGO_UNREACHABLE; } |