diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2020-10-17 03:20:24 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-10-19 15:05:16 +0000 |
commit | 082f1a153bf5245081279e0d1d57048066c493e7 (patch) | |
tree | dbe5dbc446a2705901aa5b41894d9fd85c9ea59f /src | |
parent | 38e0a213e7f38006656ecce9c782ad318ac537ca (diff) | |
download | mongo-082f1a153bf5245081279e0d1d57048066c493e7.tar.gz |
SERVER-51719 BSONElement::toString must handle len < 0CLOUDP-69887
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/bson/bsonelement.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/cst/c_node.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/bson/bsonelement.cpp b/src/mongo/bson/bsonelement.cpp index 1191f82ecf2..312eb849caf 100644 --- a/src/mongo/bson/bsonelement.cpp +++ b/src/mongo/bson/bsonelement.cpp @@ -873,7 +873,7 @@ void BSONElement::toString( if (!full && len > 80) { s << hexblob::encode(data, 70) << "...)"; } else { - s << hexblob::encode(data, len) << ")"; + s << hexblob::encode(data, std::max(len, 0)) << ")"; } } break; diff --git a/src/mongo/db/cst/c_node.cpp b/src/mongo/db/cst/c_node.cpp index 0c6db03f835..17a89a532fd 100644 --- a/src/mongo/db/cst/c_node.cpp +++ b/src/mongo/db/cst/c_node.cpp @@ -120,7 +120,7 @@ auto printValue(const T& payload) { [](const UserString& userString) { return "<UserString "s + userString + ">"; }, [](const UserBinary& userBinary) { return "<UserBinary "s + typeName(userBinary.type) + ", " + - hexblob::encode(userBinary.data, userBinary.length) + ">"; + hexblob::encode(userBinary.data, std::max(userBinary.length, 0)) + ">"; }, [](const UserUndefined& userUndefined) { return "<UserUndefined>"s; }, [](const UserObjectId& userObjectId) { |