Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-895

bsonrw.valueReader does not verify length of string before slice for CodeWithScope

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.3.1
    • Affects Version/s: 1.0.0
    • Component/s: BSON
    • None

      Within the ReadCodeWithScope method of bsonrw.valueReader we don't check the length of strBytes before attempting to remove the null byte. This can cause a panic if the BSON is invalid and strLength is 0.

      To fix this we need to check the length of strBytes and if it's 0 we need to return an error because the BSON is invalid.

       

      Thanks to @dgryski for raising this.

            Assignee:
            isabella.siu@mongodb.com Isabella Siu (Inactive)
            Reporter:
            kris.brandow@mongodb.com Kristofer Brandow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: