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

DBCollection.prototype.createIndexes can stall when given object with large "length" property

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6.0-rc0
    • Component/s: Shell
    • Labels:
      None
    • Backwards Compatibility:
      Minor Change
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      Run the following in the shell:

      db.foo.createIndexes({"length": 1000000})
      

      Show
      Run the following in the shell: db.foo.createIndexes({ "length" : 1000000 })

      Description

      When createIndexes is called, it immediately does a loop over keys.length. If instead of passing in an array for keys, we pass an object with a field called length that has a large value, the shell will stall in the loop. This causes some issues in the jstestfuzzer.

      I think the easiest solution would be to just check whether keys is actually an array at the beginning of the function, and if not, to return or throw an error without entering the loop.

      This problem is similar to the bug reported here a few years back:
      SERVER-19474

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ian.boros Ian Boros
              Reporter:
              ian.boros Ian Boros
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: