summaryrefslogtreecommitdiff
path: root/src/mongo/bson
diff options
context:
space:
mode:
authorGeert Bosch <geert@mongodb.com>2020-09-18 13:42:47 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-09-25 18:50:46 +0000
commit7f558f65ed8e8468cb57f49fe033868cb97b23f5 (patch)
tree6b2fd64e51d30f742fbba04d37771e14da3a6516 /src/mongo/bson
parent86f5e6928d6213a30dd85362eb5d157976483495 (diff)
downloadmongo-7f558f65ed8e8468cb57f49fe033868cb97b23f5.tar.gz
SERVER-50338 Avoid using negative subscript in BSONValidate
Diffstat (limited to 'src/mongo/bson')
-rw-r--r--src/mongo/bson/bson_validate.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mongo/bson/bson_validate.cpp b/src/mongo/bson/bson_validate.cpp
index 40e824a50fb..e37d09cba20 100644
--- a/src/mongo/bson/bson_validate.cpp
+++ b/src/mongo/bson/bson_validate.cpp
@@ -223,7 +223,7 @@ private:
void _maybePopCodeWithScope(Cursor cursor) {
if constexpr (precise) {
// When ending the scope of a CodeWScope, pop the extra dummy frame and check its size.
- if (_currFrame != _frames.begin() && _currFrame[-1].elem.type() == CodeWScope) {
+ if (_currFrame != _frames.begin() && (_currFrame - 1)->elem.type() == CodeWScope) {
invariant(_popFrame());
uassert(InvalidBSON, "incorrect BSON length", cursor.ptr == _currFrame->end);
}