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

V1 index broken for BinData larger than 32 bytes

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Blocker - P1 Blocker - P1
    • 1.9.2
    • Affects Version/s: 1.9.1
    • Component/s: Index Maintenance
    • None
    • ALL

      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

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

              Created:
              Updated:
              Resolved: