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

Fix range check in IndexBoundsBuilder::simpleRegex

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.5.9
    • Affects Version/s: None
    • Component/s: Index Maintenance
    • Labels:
    • Fully Compatible
    • ALL
    • Query 2017-06-19

      Unable to find source-code formatter for language: с++. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      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.

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

              Created:
              Updated:
              Resolved: