diff options
author | Louis Williams <louis.williams@mongodb.com> | 2021-06-17 10:41:48 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-06-17 15:46:38 +0000 |
commit | ba81849df916f6c417585c6cd51e6508be5001fe (patch) | |
tree | 8b9489316e8609724e84bc5104de88005ae6d82a /src/mongo/bson/bsonobjbuilder.h | |
parent | 080cff24109959bbb3536318d64697c832d106ee (diff) | |
download | mongo-ba81849df916f6c417585c6cd51e6508be5001fe.tar.gz |
SERVER-57492 Side-write table should not write more than KeyString
This fixes a bug where extra data in the form of uninitialized memory was being
written to the index builds side writes table. This memory is never observed
and only takes up space in the table.
This commit also renames BufBuilder::getSize() to capacity() to conform
to the STL convention and to prevent similar bugs in the future.
Diffstat (limited to 'src/mongo/bson/bsonobjbuilder.h')
-rw-r--r-- | src/mongo/bson/bsonobjbuilder.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mongo/bson/bsonobjbuilder.h b/src/mongo/bson/bsonobjbuilder.h index 8eeddc49ebd..50ee973d931 100644 --- a/src/mongo/bson/bsonobjbuilder.h +++ b/src/mongo/bson/bsonobjbuilder.h @@ -668,7 +668,7 @@ protected: // BufBuilder but do not own it ourselves, then we must call _done to write in the // length. Otherwise, we own this memory and its lifetime ends with us, therefore // we can elide the write. - return !_doneCalled && _b.buf() && _buf.getSize() == 0; + return !_doneCalled && _b.buf() && _buf.capacity() == 0; } // Must be called by derived class destructors. |