Following code reports: Id: containerOutOfBounds CWE: 398 Out of bounds access in 'pixel_values[i]', if 'pixel_values' size is 65535 and 'i' is 65535 This is incorrect because 'pixel_values' size is constexpr 65535 + 1 = 65536 Code: #include <array> constexpr unsigned int MIN_VALUE = 0; constexpr unsigned int MAX_VALUE = 0xFFFF; std::array<uint16_t, MAX_VALUE + 1> pixelValues(const unsigned int blackPoint, const unsigned int whitePoint) { std::array<uint16_t, MAX_VALUE + 1> pixel_values = {}; const...
Following code reports: Id: containerOutOfBounds CWE: 398 Out of bounds access in 'pixel_values[i]', if 'pixel_values' size is 65535 and 'i' is 65535 This is incorrect because 'pixel_values' size is constexpr 65535 + 1 = 65536 Code: #include <array> constexpr unsigned int MIN_VALUE = 0; constexpr unsigned int MAX_VALUE = 0xFFFF; std::array<uint16_t, MAX_VALUE + 1> pixelValues(const unsigned int blackPoint, const unsigned int whitePoint) { std::array<uint16_t, MAX_VALUE + 1> pixel_values = {}; const...