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

V1 index broken for BinData larger than 32 bytes

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker - P1
    • Resolution: Fixed
    • Affects Version/s: 1.9.1
    • Fix Version/s: 1.9.2
    • Component/s: Indexing
    • Labels:
      None
    • Operating System:
      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

            Assignee:
            dwight_10gen Dwight Merriman
            Reporter:
            redbeard0531 Mathias Stearn
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: