summaryrefslogtreecommitdiff
path: root/src/mongo/bson
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2017-07-07 01:03:50 -0400
committerSara Golemon <sara.golemon@mongodb.com>2017-07-07 11:42:28 -0400
commit3ee00dd0e8f36c6223524012e925055e94b05080 (patch)
tree5597bf941d1e18c9dd3d55971c712edabe655bb8 /src/mongo/bson
parent7110b3b92cb23dc2ffc6b8d8a648956a2f86051e (diff)
downloadmongo-3ee00dd0e8f36c6223524012e925055e94b05080.tar.gz
SERVER-15194 Refactor base64::decode Implementation
Unrevert 4b222edf455a34667cfaf7b67e7f8dfdca42bd9c and Fix random base64 generation in test helper The good news is that the changes to base64::decode() did exactly what they were intended to do. The bad news is that data_generators.js was producing invalid base64 sequences when (length % 4) == 1.
Diffstat (limited to 'src/mongo/bson')
-rw-r--r--src/mongo/bson/json.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/mongo/bson/json.cpp b/src/mongo/bson/json.cpp
index d6a94ea08eb..647accf31ba 100644
--- a/src/mongo/bson/json.cpp
+++ b/src/mongo/bson/json.cpp
@@ -1280,13 +1280,7 @@ bool JParse::isHexString(StringData str) const {
bool JParse::isBase64String(StringData str) const {
MONGO_JSON_DEBUG("str: " << str);
- std::size_t i;
- for (i = 0; i < str.size(); i++) {
- if (!match(str[i], base64::chars)) {
- return false;
- }
- }
- return true;
+ return base64::validate(str);
}
bool JParse::isArray() {