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

$substrBytes does not handle negative parameters correctly.

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 3.1.4
    • 3.7.4
    • Aggregation Framework
    • Minor Change
    • ALL
    • Query 2018-03-26

    Description

      $substrBytes requires two arguments: starting index, and length. Parsing and validation occurs here.

      Both are required to be integral, however, we static cast the values to a size_t without checking to ensure they're nonnegative. At the very least, we should give an informative error message if they are negative. It is also conceivable that we want a negative value to mean "return the rest of the string", as in some other operators, in which case we'll need to add special handling.

      Attachments

        Issue Links

          Activity

            People

              ian.boros@mongodb.com Ian Boros
              benjamin.murphy Benjamin Murphy
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: