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

panic in bsoncore StringValue function on malformed document

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 1.5.1
    • None
    • None
    • None
    • Not Needed

    Description

      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

       

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: