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

Create collection command should check type of argument

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.0-rc0
    • Component/s: None
    • Labels:
      None
    • Operating System:
      ALL

      Description

      Currently assumes it is a string without checking. This causes the following commands to treat garbage memory as strings. I haven't been able to crash the server with this, but I do get some odd collection names:

      > db.runCommand(

      {create:true}

      )

      { "ok" : 1 }

      > db.runCommand(

      {create:null}

      )

      { "ok" : 1 }

      > db.createCollection() // same as

      {create:undefined} { "ok" : 1 }

      > show tables
      Status // from create:true
      n( // from create: null
      ped // from createCollection()

      see attached one-line patch for an easy fix which gives a helpful message:

      > db.createCollection()
      {
      "errmsg" : "exception: must pass name of collection to create",
      "code" : 15888,
      "ok" : 0
      }

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: