Static Analysis Rule
Hi,
I analyse my code with recommended rule set but I noticed the following thing;
I can easly detect array out of bound for example;
int scores[] {100, 90, 80};
for (int i = 0; i <= scores.size() ; i++) // I take a violation about array out of bound error
{
.....
}
But I have a method which takes transpose of matris. My methos is like as follows;
void matris_transpose (a* matA, a* transpose_matA, int row_num_matA, int col_num_matA,)
{
for(int i = 0; i < row_num_matA; i++){
for(int j = 0; j < col_num_matA; j++){
transpose_matA[(j* row_num_matA) + i] = matA[(i * col_num_matA) + j ];
}
}
I call the following method like follows;
a m[3][1] = {0}, mt[1][3] = {0};
matris_transpose((a) m, (a)mt, 3 , 3); //Mistake is the last paramater "3" the true parameter //value should equal to "1"
But parasoft does not handle this problem. After analysis it does not say a violation about array out of bound.
Which rule id in parasoft rules can finf this problem?
Could you help me for this issue? This error takes me a lot of time and I find this error by a fluke