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

typeEncoderCache.LoadOrStore will panic when enc is nil

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Unknown Unknown
    • None
    • 1.13.0
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

    Description

      Detailed steps to reproduce the problem?

      Call typeEncoderCache.LoadOrStore twice will panic when enc is nil.

      enc = v.(ValueEncoder) should be enc, _ = v.(ValueEncoder)

      
      

      _func (c *typeEncoderCache) LoadOrStore(rt reflect.Type, enc ValueEncoder) ValueEncoder {
      if v, loaded := c.cache.LoadOrStore(rt, enc); loaded

      { enc = v.(ValueEncoder) }

      return enc
      }_

       

      Attachments

        Activity

          People

            qingyang.hu@mongodb.com Qingyang Hu
            wxblue@gmail.com x w
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: