diff options
author | mike o'brien <mpobrien005@gmail.com> | 2015-09-29 11:10:37 -0400 |
---|---|---|
committer | mike o'brien <mpobrien005@gmail.com> | 2015-09-29 11:10:37 -0400 |
commit | 50af9d7447934863c45bfd602e593f75a4849b4b (patch) | |
tree | 187358e04ce6bf1fca6209b5b350d7ed682c48ab | |
parent | 134c548992e8248c7a7c53777a652cbb2490ab6c (diff) | |
parent | 20197d6f4add76bdf25138b167341b29e43a824e (diff) | |
download | mongo-50af9d7447934863c45bfd602e593f75a4849b4b.tar.gz |
Merge pull request #39 from tessavitabile/TOOLS-878_v3.0
TOOLS-878_v3.0 BSON stream decoder checks for size < 5
-rw-r--r-- | common/db/bson_stream.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/common/db/bson_stream.go b/common/db/bson_stream.go index 35304a7c43b..1cfdc29904b 100644 --- a/common/db/bson_stream.go +++ b/common/db/bson_stream.go @@ -91,7 +91,8 @@ func (bs *BSONSource) LoadNextInto(into []byte) (bool, int32) { // Verify that the size of the BSON object we are about to read can // actually fit into the buffer that was provided. If not, either the BSON is // invalid, or the buffer passed in is too small. - if bsonSize > int32(len(into)) { + // Verify that we do not have an invalid BSON document with size < 5. + if bsonSize > int32(len(into)) || bsonSize < 5 { bs.err = fmt.Errorf("invalid BSONSize: %v bytes", bsonSize) return false, 0 } |