summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew Paroski <drew.paroski@mongodb.com>2021-10-14 21:03:39 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-10-15 23:34:28 +0000
commite77eda3f09dcd2be820b1f1eec7ce8ac6c0cf477 (patch)
tree8f0878d15b221236d1054a77016af9024df8131a
parent7a68603aed1dd0b75caf0faae3a9986886af0f18 (diff)
downloadmongo-e77eda3f09dcd2be820b1f1eec7ce8ac6c0cf477.tar.gz
SERVER-60723 Fix a bug with how sbe::bson::convertFrom() computes the size of a BinData
-rw-r--r--src/mongo/db/exec/sbe/values/bson.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/mongo/db/exec/sbe/values/bson.cpp b/src/mongo/db/exec/sbe/values/bson.cpp
index c0dd70eb4d7..d8ebe574b46 100644
--- a/src/mongo/db/exec/sbe/values/bson.cpp
+++ b/src/mongo/db/exec/sbe/values/bson.cpp
@@ -158,20 +158,10 @@ std::pair<value::TypeTags, value::Value> convertFrom(const char* be,
}
auto size = ConstDataView(be).read<LittleEndian<uint32_t>>();
- auto subtype = static_cast<BinDataType>((be + sizeof(uint32_t))[0]);
-
- if (subtype != BinDataType::ByteArrayDeprecated) {
- auto metaSize = sizeof(uint32_t) + 1;
- auto binData = new uint8_t[size + metaSize];
- memcpy(binData, be, size + metaSize);
- return {value::TypeTags::bsonBinData, value::bitcastFrom<uint8_t*>(binData)};
- } else {
- // The legacy byte array stores an extra int32 in byte[size].
- auto metaSize = 2 * sizeof(uint32_t) + 1;
- auto binData = new uint8_t[size + metaSize];
- memcpy(binData, be, size + metaSize);
- return {value::TypeTags::bsonBinData, value::bitcastFrom<uint8_t*>(binData)};
- }
+ auto metaSize = sizeof(uint32_t) + 1;
+ auto binData = new uint8_t[size + metaSize];
+ memcpy(binData, be, size + metaSize);
+ return {value::TypeTags::bsonBinData, value::bitcastFrom<uint8_t*>(binData)};
}
case BSONType::Object: {
if constexpr (View) {