diff options
author | Tess Avitabile <tess.avitabile@mongodb.com> | 2016-09-02 16:19:48 -0400 |
---|---|---|
committer | Tess Avitabile <tess.avitabile@mongodb.com> | 2016-09-06 10:25:53 -0400 |
commit | 8f83b3e0937dc0b471c408714108ced515397e01 (patch) | |
tree | e9536ede333634163c525c13e1e7b0341888004c /src/mongo/db/dbmessage.cpp | |
parent | 27551f97e11e611f894fa1dfedf4d93c83962dd4 (diff) | |
download | mongo-8f83b3e0937dc0b471c408714108ced515397e01.tar.gz |
SERVER-23972 Disallow decimal insertion in legacy write mode when featureCompatibilityVersion is 3.2
Diffstat (limited to 'src/mongo/db/dbmessage.cpp')
-rw-r--r-- | src/mongo/db/dbmessage.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/mongo/db/dbmessage.cpp b/src/mongo/db/dbmessage.cpp index 4b5f5054ccf..182d538764b 100644 --- a/src/mongo/db/dbmessage.cpp +++ b/src/mongo/db/dbmessage.cpp @@ -32,6 +32,7 @@ #include "mongo/db/dbmessage.h" #include "mongo/db/operation_context.h" #include "mongo/platform/strnlen.h" +#include "mongo/rpc/object_check.h" #include "mongo/transport/session.h" namespace mongo { @@ -120,16 +121,14 @@ const char* DbMessage::getArray(size_t count) const { } BSONObj DbMessage::nextJsObj() { - massert(10304, + uassert(ErrorCodes::InvalidBSON, "Client Error: Remaining data too small for BSON object", _nextjsobj != NULL && _theEnd - _nextjsobj >= 5); if (serverGlobalParams.objcheck) { - // TODO SERVER-23972: Change BSONVersion::kLatest to - // Validator<BSONObj>::enabledBSONVersion() so that we disallow decimal inserts in legacy - // write mode if decimal is disabled. - Status status = validateBSON(_nextjsobj, _theEnd - _nextjsobj, BSONVersion::kLatest); - massert(10307, + Status status = validateBSON( + _nextjsobj, _theEnd - _nextjsobj, Validator<BSONObj>::enabledBSONVersion()); + uassert(ErrorCodes::InvalidBSON, str::stream() << "Client Error: bad object in message: " << status.reason(), status.isOK()); } |