summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2020-10-17 18:17:38 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-10-17 22:38:39 +0000
commit5362f02f26313574e3aa8cadcc6fd66bc43f301b (patch)
tree38fd22b07410152d950a65fb90d0f8a3bea2a787
parenta82350f6b16f85067c2137dfeeb2b71d49f45ee8 (diff)
downloadmongo-5362f02f26313574e3aa8cadcc6fd66bc43f301b.tar.gz
SERVER-51485 fix std::bitset out of bounds in test
-rw-r--r--src/mongo/util/str_test.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mongo/util/str_test.cpp b/src/mongo/util/str_test.cpp
index 31913d38e0c..22b7d81a0e2 100644
--- a/src/mongo/util/str_test.cpp
+++ b/src/mongo/util/str_test.cpp
@@ -315,7 +315,7 @@ TEST(StringUtilsTest, UTF8SafeTruncation) {
TEST(StringUtilsTest, GetCodePointLength) {
for (int i = 0x0; i < 0x100; ++i) {
size_t n = 0;
- for (std::bitset<8> bs(i); bs[7 - n]; ++n) {
+ for (std::bitset<8> bs(i); n < bs.size() && bs[7 - n]; ++n) {
}
if (n == 1)
continue; // Avoid the invariant on 0b10xx'xxxx continuation bytes.