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

panic in bsoncore StringValue function on malformed document

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.1
    • Affects Version/s: None
    • Component/s: None
    • None
    • Not Needed

      Problem Statement/Rationale

      v := bsoncore.Value{
        Type: bsontype.String,
        Data: []byte("\x00\x00\x00\x00"),
      }
      _, _ = v.StringValueOK()
      

      This code will throw a panic, due to an invalid slice operation on
      https://github.com/mongodb/mongo-go-driver/blob/master/x/bsonx/bsoncore/bsoncore.go#L825

       

            Assignee:
            benji.rewis@mongodb.com Benji Rewis (Inactive)
            Reporter:
            stephen.white@mongodb.com Stephen White
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: