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

Fix range check in IndexBoundsBuilder::simpleRegex

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor - P4 Minor - P4
    • 3.5.9
    • None
    • Index Maintenance
    • Fully Compatible
    • ALL
    • Query 2017-06-19

    Description

      string IndexBoundsBuilder::simpleRegex(....) {
        ....
        if (c == 'Q') {
          ....
        } else if ((c >= 'A' && c <= 'Z') || 
                   (c >= 'a' && c <= 'z') || 
                   (c >= '0' && c <= '0') ||          // <=
                   (c == '\0')) {
          ....
        }
        ....
      }
      

      A link to the source code on GitHub

      PVS-Studio warning: V590 Consider inspecting the 'c >= '0' && c <= '0'' expression. The expression is excessive or contains a misprint. index_bounds_builder.cpp 145

      Most likely, the subexpression c >= '0' && c <= '0' has an error, there is no range check of the symbol (this subexpression will be true only in case c == '0'). Judging by other subexpressions, supposedly it should be as follows: c >= '0' && c <= '9'.

      This issue was originally reported in SERVER-28570.

      Attachments

        Activity

          People

            anne.lim Anne Lim
            kelsey.schubert@mongodb.com Kelsey Schubert
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: