![]() |
![]() |
2840 | ![]() |
||||
![]() | |||||||
| Arrays | |||||||
An element outside the bounds of an array is being accessed - either for reading or writing. Behaviour will be undefined. For example:
/*PRQA S 488,2017,3120,3132,3199,3203,3408,3447 ++*/
extern int a[10];
extern int foo(void)
{
int r;
r = a[10]; /* 2840 */
a[10] = 0; /* 2840 */
*(a + 10) = 0; /* 2840 */
return r;
}
MISRA-C:2004 Rules applicable to message 2840:
| Rule 1.2 (Required) | No reliance shall be placed on undefined or unspecified behaviour. |
| Rule 20.3 (Required) | The validity of values passed to library functions shall be checked. |
See also:
![]() | ||
| QA·C Source Code Analyser 8.1
MISRA-C:2004 Compliance Module 3.2 © 2012 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index | Contents |