Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-3157

add warning about numerical overflow of limit() value

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: v1.3.4
    • Component/s: manual
    • Labels:
      None
    • Last comment by Customer:
      true
    • Actual Time:
      4

      Description

      The skip() and limit() values are passed as 32-bit signed integers in the OP_QUERY message of the wire protocol. This means that if you provide values which are too big, they can overflow and become negative.

      For skip(), this isn't a problem because negative skip values are validated and rejected. For limit(), however, a negative limit has a special meaning and is accepted by the server. This means that large limit() values can overflow. The server shouldn't behave too badly in this case, but it does mean that the limit you get might be different from the limit you ask for. Can we add a warning that the behavior of limit is undefined for values outside of [-2^31, (2^31)-1] to this page: http://docs.mongodb.org/manual/reference/method/cursor.limit/?

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sam.kleinman Sam Kleinman (Inactive)
              Reporter:
              david.storch David Storch
              Participants:
              Last commenter:
              Jonathan Dahl Jonathan Dahl
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since reply:
                7 years, 1 day ago
                Date of 1st Reply: