/
1st Array Index Out Of Bounds

1st Array Index Out Of Bounds

This checks array index out of bounds.(for now, one-dimensional array)

 

refer to below example:

Caution: It is possible there will be more test cases.

case 1

void function(int* array_parameter) 

{

int basic_array[9]={0,};

 

for(int i=0 ; i<11 ; i++)  

{   

             basic_array[i]=0;

 }  

printf("basic_array[10] : %d ",basic_array[10]);

printf("*(basic_array+10) : %d ",*(basic_array+10));

 

 for(int i=0; i<11; i++)  

{   

 array_parameter[i]=0;

}

}

case 2

void function(int array_parameter[]) {  

int basic_array[9]={0,};

 

for(int i=0 ; i<11 ; i++)  {   

             basic_array[i]=0;

 }  

printf("basic_array[10] : %d ",basic_array[10]);  

printf("*(basic_array+10) : %d ",*(basic_array+10));

 

 for(int i=0; i<11; i++)  

{    

array_parameter[i]=0;

}

}

 

 

the checker config can be like below:

 

{
  "code""CHECK_ARRAY_INDEX_OUT_OF_BOUNDS",
  "name""Checking array index out of bounds",
  "type""BOTH",
  "categoryName""Tizen",
  "severityCode""CRI",
  "version""2.5.33",
  "description""Array index out of bounds",
  "isActive"false,
  "properties": {       
  },
  "cwe"129
}

 

 

Related content