Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1307

Timestamp() does not validate the argument potentially resulting into an overflow

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.8.0
    • Affects Version/s: None
    • Component/s: Shell API
    • None
    • Not Needed

      Problem Statement/Rationale

      mongosh does not validate the timestamp value passed in

      Please be sure to attach relevant logs with any sensitive data redacted.

      Steps to Reproduce

      "Overflow in mongosh"
      [direct: mongos] test> var a = Timestamp(16577179010)
      
      [direct: mongos] test> a
      Timestamp({ t: -602690174, i: 0 })
      [direct: mongos] test>
      
      // Compared to mongo
      mongos> var a = Timestamp(16577179010,0)
      Error: Timestamp time (seconds) must be non-negative and not greater than 4294967295, got 16577179010 :
      @(shell):1:9
      

      Expected Results

      Same outcome as in mongo

      Actual Results

      Incorrect value gets accepted resulting into an overflow

      Additional Notes

      none

            Assignee:
            Unassigned Unassigned
            Reporter:
            dmitry.ryabtsev@mongodb.com Dmitry Ryabtsev
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: