Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

where the integer expression size and the declaration of vla are both evaluated at runtime. If the size argument supplied to a variable length array is not a positive integer value, the behavior is undefined. (See undefined behavior 75 in Annex J of the C Standard [ISO/IEC 9899:2011].) In addition, if the magnitude of the argument is excessive, the program may behave in an unexpected way. An attacker may be able to leverage this behavior to overwrite critical program data [Griffiths 2006]. The programmer must ensure that size arguments to variable length arrays, especially those derived from untrusted data, are in a valid range.

...

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

ARR32-C

highHigh

probableProbable

highHigh

P6

L2

Automated Detection

Tool

Version

Checker

Description

Coverity6.5REVERSE_NEGATIVEFully Implemented
PRQA QA-C
Include Page
PRQA_V
PRQA_V
1051Partially implemented

...

CERT C Secure Coding StandardINT01-C. Use rsize_t or size_t for all integer values representing the size of an object
ISO/IEC TR 24772:2013Unchecked Array Indexing [XYZ]
ISO/IEC TS 17961Tainted, potentially mutilated, or out-of-domain integer values are used in a restricted sink [taintsink]

Bibliography

...

 
Annex J, J.2, "Undefined behavior" [Griffiths 2006]

 

...