Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-878

BSON decoding does not properly error when bsonSize < 5.

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.9
    • Affects Version/s: 3.0.5, 3.1.6
    • Component/s: bsondump, mongorestore
    • None
    • Server Tools A (10/09/15)
    • v3.0

      The code for decoding a BSON stream does not properly catch all invalid sizes. We check that a document size isn't > 16MB, but not that it isn't less than 5. So when we have an invalid bson document with size < 5, and we hit the line

      	_, err = io.ReadAtLeast(bs.Stream, into[4:int(bsonSize)], int(bsonSize-4))
      

      we get a

      panic: runtime error: slice bounds out of range
      

            Assignee:
            tess.avitabile@mongodb.com Tess Avitabile (Inactive)
            Reporter:
            kyle.erf Kyle Erf
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: