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

Error strings should escape embedded strings

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Trivial - P5 Trivial - P5
    • None
    • 2.0.3
    • Shell
    • None
    • ALL

    Description

      > db.test.ensureIndex(

      {x:1}

      ,

      {unique:true}

      )
      > db.test.insert(

      {'x': 'y\u0000a'}

      )
      > db.test.insert(

      {'x': 'y\u0000a'}

      )
      E11000 duplicate key error index: test.test.$x_1 dup key: { : "y

      The "y\0a" string has an embedded \0, which is being inserted literally into the E11000 error, causing it to be truncated at some point later.

      Error message strings from the server should probably be escaped to not contain embedded nulls, so it doesn't need to be dealt with in each driver.

      Attachments

        Activity

          People

            geert.bosch@mongodb.com Geert Bosch
            glenn Glenn Maynard
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: