-
Notifications
You must be signed in to change notification settings - Fork 68
Closed as duplicate of#66
Labels
Stardard-CERT-C++false positive/false negativeAn issue related to observed false positives or false negatives.An issue related to observed false positives or false negatives.user-reportIssue reported by an end user of CodeQL Coding StandardsIssue reported by an end user of CodeQL Coding Standards
Description
Affected rules
- cpp/cert/range-check-string-element-access
Description
The rule hits on a fixed string length.
The provided code snippet shows a simple 16-base converter yet the rule states
Access of container of type const string does not ensure that the index is smaller than the bounds.
Even though the reminder operation minimum value will be always 0
and the string d
will never be empty.
Example
#include <iostream>
#include <string>
int main() {
std::string word(" ");
auto num = 100000;
static const std::string d = "0123456789ABCDEF";
while (num > 0) {
word = d[num % 16] + word;
num /= 16;
}
return 0;
}
Metadata
Metadata
Assignees
Labels
Stardard-CERT-C++false positive/false negativeAn issue related to observed false positives or false negatives.An issue related to observed false positives or false negatives.user-reportIssue reported by an end user of CodeQL Coding StandardsIssue reported by an end user of CodeQL Coding Standards
Type
Projects
Status
Closed (Duplicate)