diff options
author | Fox Lady <dandanlin.l@gmail.com> | 2018-03-20 13:05:50 -0400 |
---|---|---|
committer | Charlie Swanson <charlie.swanson@mongodb.com> | 2018-05-11 18:24:04 -0400 |
commit | f2853bb09946ce5bb7779ff6ad8139a23cf35a90 (patch) | |
tree | 609a6620aa37fd1eb407bdb014368a535511865d /src/mongo/db/commands | |
parent | 23533e463e1fabbd9bed8753b013f1028292636d (diff) | |
download | mongo-f2853bb09946ce5bb7779ff6ad8139a23cf35a90.tar.gz |
SERVER-19904 Avoid massert on field of incorrect type.
Closes #1239
Signed-off-by: Charlie Swanson <charlie.swanson@mongodb.com>
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r-- | src/mongo/db/commands/dbcommands_d.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mongo/db/commands/dbcommands_d.cpp b/src/mongo/db/commands/dbcommands_d.cpp index a323bd2b3d0..2ad790dedb6 100644 --- a/src/mongo/db/commands/dbcommands_d.cpp +++ b/src/mongo/db/commands/dbcommands_d.cpp @@ -195,6 +195,13 @@ public: // it just passes the buffer through to another mongod. BSONElement stateElem = jsobj["md5state"]; if (!stateElem.eoo()) { + uassert(50847, + str::stream() << "The element that calls binDataClean() must be type of " + "BinData, but type of " + << typeName(stateElem.type()) + << " found.", + (stateElem.type() == BSONType::BinData)); + int len; const char* data = stateElem.binDataClean(len); massert(16247, "md5 state not correct size", len == sizeof(st)); @@ -248,6 +255,18 @@ public: // make a copy of obj since we access data in it while yielding locks BSONObj owned = obj.getOwned(); + uassert(50848, + str::stream() << "The element that calls binDataClean() must be type " + "of BinData, but type of misisng found. Field name is " + "required", + owned["data"]); + uassert(50849, + str::stream() << "The element that calls binDataClean() must be type " + "of BinData, but type of " + << owned["data"].type() + << " found.", + owned["data"].type() == BSONType::BinData); + exec->saveState(); // UNLOCKED ctx.reset(); |