[SERVER-29002] Fix range check in IndexBoundsBuilder::simpleRegex Created: 27/Apr/17  Updated: 30/Oct/23  Resolved: 01/Jun/17

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: None
Fix Version/s: 3.5.9

Type: Bug Priority: Minor - P4
Reporter: Kelsey Schubert Assignee: Anne Lim
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-28570 Analysis of 'MongoDB' source code by ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Query 2017-06-19
Participants:

 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.



 Comments   
Comment by Githook User [ 01/Jun/17 ]

Author:

{u'name': u'Anne Lim', u'email': u'anne.lim@mongodb.com'}

Message: SERVER-29002: Fixed typo in IndexBoundsBuilder::simpleRegex
Branch: master
https://github.com/mongodb/mongo/commit/6d36b9c90db9fea2c92f90ea7d9775a72b8fa339

Generated at Thu Feb 08 04:19:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.