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

[4.4] mongod collStats does not handle large values for scale

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 4.4.7
    • 4.4.5
    • Storage
    • None
    • Fully Compatible
    • ALL
    • Execution Team 2021-05-17, Execution Team 2021-05-31

    Description

      When the collStats command is given a scale value that is too large for the integer type, a 4.4 server may fail with a BadValue error. This behavior was addressed in 4.9 and 5.0 when the collStats option handling was converted to using a IDL-generated parser that uses BSONElement::safeNumberInt().

      4.4.5:
       
      > db.t.insert({_id: 0})
      WriteResult({ "nInserted" : 1 })
      > db.t.stats().storageSize
      4096
      > db.t.stats(100).storageSize
      40
      > db.t.stats(Number.MAX_VALUE).storageSize
      > db.t.stats(Number.MAX_VALUE)
      { "ns" : "test.t", "ok" : 0, "errmsg" : "scale has to be >= 1" }
       
      4.9.0-rc1:
       
      > db.t.insert({_id: 0})
      WriteResult({ "nInserted" : 1 })
      > db.t.stats().storageSize
      4096
      > db.t.stats(100).storageSize
      40
      > db.t.stats(Number.MAX_VALUE).storageSize
      0
      

      Attachments

        Activity

          People

            benety.goh@mongodb.com Benety Goh
            benety.goh@mongodb.com Benety Goh
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: