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

$substrBytes does not handle negative parameters correctly.

    • Minor Change
    • ALL
    • Query 2018-03-26

      $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.

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

              Created:
              Updated:
              Resolved: