Fix ChangeStream.SetBatchSize() panics due to nil cursor

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Unknown
    • 2.7.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Go Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Tracking external PR #2424

      Detailed steps to reproduce the problem?

      SetBatchSize does not guard against a nil cs.cursor, which causes a panic if called on a ChangeStream that has not been initialized or has already been closed.
      Other methods such as Decode already handle this case explicitly.

      Definition of done: what must be done to consider the task complete?

      • Added a nil check for cs.cursor in SetBatchSize
      • Added a nil cursor test case

      The exact Go version used, with patch level:

      $ go version

      The exact version of the Go driver used:

      $ go list -m go.mongodb.org/mongo-driver

      Describe how MongoDB is set up. Local vs Hosted, version, topology, load balanced, etc.

      The operating system and version (e.g. Windows 7, OSX 10.8, ...)

      Security Vulnerabilities

      If you’ve identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here

            Assignee:
            Qingyang Hu
            Reporter:
            Qingyang Hu
            Qingyang Hu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: