Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-3505

V1 index broken for BinData larger than 32 bytes

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Blocker - P1
    • Resolution: Fixed
    • 1.9.1
    • 1.9.2
    • Index Maintenance
    • None
    • ALL

    Description

      Base64 of 33byte string created like this in python:
      In [7]: ('x'*33).encode('base64')
      Out[7]: 'eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4\n'

      > db.foo.drop()
      true
      > b = new BinData(0,'eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4')
      BinData(0,"eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4")
      > db.foo.insert(

      {b:b}

      )
      > db.foo.count(

      {b:b}

      )
      1
      > db.foo.ensureIndex(

      {b:1}

      ,

      {v:1}

      )
      > db.foo.count(

      {b:b}

      )
      0
      > db.foo.dropIndex(

      {b:1}

      )

      { "nIndexesWas" : 2, "ok" : 1 }

      > db.foo.ensureIndex(

      {b:1}

      ,

      {v:0}

      )
      > db.foo.count(

      {b:b}

      )
      1

      The problem is in KeyV1Owned constructor. We need to check if len <= 32 before this line https://github.com/mongodb/mongo/blob/master/db/key.cpp#L267

      Attachments

        Activity

          People

            dwight@mongodb.com Dwight Merriman
            mathias@mongodb.com Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: