Hi, I use cppcheck-2.14.1 to check the following code
#include <string> using namespace std; int main() { string ss[1]; ss->clear(); //(*ss).clear(); // OK //ss[0].clear(); // OK string s; s.append(ss[i]); return 0; }
, and get CWE: 398 Out of bounds access in expression 'ss[i]' because 'ss' is empty.
Is this a false positive?
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/12993
Thank you for the confirmation.
Log in to post a comment.
Hi,
I use cppcheck-2.14.1 to check the following code
, and get
CWE: 398
Out of bounds access in expression 'ss[i]' because 'ss' is empty.
Is this a false positive?
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/12993
Thank you for the confirmation.