-
Notifications
You must be signed in to change notification settings - Fork 68
Open
Labels
Difficulty-MediumA false positive or false negative report which is expected to take 1-5 days effort to addressA false positive or false negative report which is expected to take 1-5 days effort to addressImpact-LowStardard-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/container-access-without-range-check-cert
Description
The rule warns about the vector container which is resized after delectation.
Access of container of type Payload does not ensure that the index is smaller than the bounds.
Example
#include <iostream>
#include <string>
#include <vector>
#include <filesystem>
using namespace std;
namespace fs = std::filesystem;
int main() {
typedef vector<uint8_t> Payload;
wstring file(L"This is a wstring");
uint64_t attributes;
Payload serialized_data; serialized_data.resize(file.size() * sizeof(wchar_t) + sizeof(attributes));
*(uint64_t*)&serialized_data.front() = attributes;
/*
* Append the path.
*/
file.copy((wchar_t*)&serialized_data[sizeof(attributes)], file.size());
return 0;
}
Metadata
Metadata
Assignees
Labels
Difficulty-MediumA false positive or false negative report which is expected to take 1-5 days effort to addressA false positive or false negative report which is expected to take 1-5 days effort to addressImpact-LowStardard-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
Triaged