summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kneiser <matt.kneiser@mongodb.com>2022-09-29 04:10:10 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-29 04:47:10 +0000
commit1912e879e904b96a331cd2a2d20e7abf23684359 (patch)
tree5427d93f5fafcd41bee6085cc1dd5fcc7e4102b4
parent0c73119d5c99a0e705f834b64fa9d9a47b767597 (diff)
downloadmongo-1912e879e904b96a331cd2a2d20e7abf23684359.tar.gz
SERVER-69784 Fix signed char misuses
-rw-r--r--src/mongo/db/query/fle/encrypted_predicate.h3
-rw-r--r--src/mongo/shell/linenoise.cpp5
-rw-r--r--src/mongo/util/net/ssl_manager.cpp3
3 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/db/query/fle/encrypted_predicate.h b/src/mongo/db/query/fle/encrypted_predicate.h
index ac4d55b811a..d6c379f6350 100644
--- a/src/mongo/db/query/fle/encrypted_predicate.h
+++ b/src/mongo/db/query/fle/encrypted_predicate.h
@@ -130,7 +130,8 @@ protected:
// Check that the BinData's subtype is 6, and its sub-subtype is equal to this predicate's
// encryptedBinDataType.
- return dataLen >= 1 && data[0] == static_cast<uint8_t>(encryptedBinDataType());
+ return dataLen >= 1 &&
+ static_cast<uint8_t>(data[0]) == static_cast<uint8_t>(encryptedBinDataType());
}
/**
diff --git a/src/mongo/shell/linenoise.cpp b/src/mongo/shell/linenoise.cpp
index 364b1041d7c..b5cb5d09c40 100644
--- a/src/mongo/shell/linenoise.cpp
+++ b/src/mongo/shell/linenoise.cpp
@@ -119,6 +119,7 @@
#include <string>
#include <vector>
+#include "mongo/base/data_view.h"
#include "mongo/util/errno_util.h"
using std::string;
@@ -352,7 +353,7 @@ public:
}
Utf32String killedText(text, textLen);
if (lastAction == actionKill && size > 0) {
- int slot = indexToSlot[0];
+ int slot = mongo::ConstDataView(&indexToSlot[0]).read<uint8_t>();
int currentLen = theRing[slot].length();
int resultLen = currentLen + textLen;
Utf32String temp(resultLen + 1);
@@ -375,7 +376,7 @@ public:
size++;
theRing.push_back(killedText);
} else {
- int slot = indexToSlot[capacity - 1];
+ int slot = mongo::ConstDataView(&indexToSlot[capacity - 1]).read<uint8_t>();
theRing[slot] = killedText;
memmove(&indexToSlot[1], &indexToSlot[0], capacity - 1);
indexToSlot[0] = slot;
diff --git a/src/mongo/util/net/ssl_manager.cpp b/src/mongo/util/net/ssl_manager.cpp
index 6cd55213043..df1022648e5 100644
--- a/src/mongo/util/net/ssl_manager.cpp
+++ b/src/mongo/util/net/ssl_manager.cpp
@@ -36,6 +36,7 @@
#include <string>
#include <vector>
+#include "mongo/base/data_view.h"
#include "mongo/base/init.h"
#include "mongo/bson/bsonobjbuilder.h"
#include "mongo/client/internal_auth.h"
@@ -1050,7 +1051,7 @@ StatusWith<DERToken> DERToken::parse(ConstDataRange cdr, size_t* outLength) {
derLength = ConstDataView(lengthBuffer.data()).read<BigEndian<uint64_t>>();
} else {
// Length is <= 127 bytes, i.e. short form of length
- derLength = initialLengthByte;
+ derLength = ConstDataView(&initialLengthByte).read<uint8_t>();
}
// This is the total length of the TLV and all data