Hi,
I think I´ve found a false positive regarding std::array. Consider the following code:
int main (){ std::array<float, 10> result = {}; for (size_t j = 0; j < 10; ++j) { result[j] = 1.0F;} }
Which result with V2.4 in the following error: CWE: 398 Out of bounds access in expression 'result[j]' because 'result' is empty.
If I change the code to the error is gone:
int main (){ std::array<float, 10> result {}; for (size_t j = 0; j < 10; ++j) { result[j] = 1.0F;} }
V2.3 did not have any issues with the code!
Best regards Steffen
Thanks for the report, I have created a ticket here: https://trac.cppcheck.net/ticket/10216
Log in to post a comment.
Hi,
I think I´ve found a false positive regarding std::array. Consider the following code:
Which result with V2.4 in the following error:
CWE: 398
Out of bounds access in expression 'result[j]' because 'result' is empty.
If I change the code to the error is gone:
V2.3 did not have any issues with the code!
Best regards
Steffen
Thanks for the report, I have created a ticket here: https://trac.cppcheck.net/ticket/10216