Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added PC-lint Plus to Automated Detection Table

Memory is a limited resource and can be exhausted. Available memory is typically bounded by the sum of the amount of physical memory and the swap space allocated to the operating system by the administrator. For example, a system with 1GB of physical memory configured with 2GB of swap space may be able to allocate, at most, 3GB of heap space total to all running processes (minus the size of the operating system itself and the text and data segments of all running processes). Once all virtual memory has been allocated, requests for more memory will fail. As discussed in void MEM32ERR33-C. Detect and handle memory allocation standard library errors, programs that fail to check for and properly handle memory allocation failures will have undefined behavior and are likely to crash when heap space is exhausted. Heap exhaustion can result from

...

It is difficult to pinpoint violations of this recommendation because static analysis tools are currently unable to identify code that can lead to heap exhaustion. The heap size also varies for different runtime environments.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

MEM11-C

Low

Probable

High

P2

L3

Automated Detection

Tool

Version

Checker

Description

CodeSonar
Include Page
CodeSonar_V
CodeSonar_V

ALLOC.LEAK

ALLOC.SIZE.SUBUFLOW

IO.TAINT.SIZE
MISC.MEM.SIZE.BAD
(general)

Leak

Subtraction Underflow of Allocation Size


Tainted

Allocation Size

allocation size
Unreasonable

Size Argument

size argument
Library models account for allocator failure cases

LDRA tool suite
Include Page
LDRA_V
LDRA_V

26 S, 140 S, 6 D, 28 D, 5 C, 1 U

Partially implemented
PC-lint Plus

Include Page
PC-lint Plus_V
PC-lint Plus_V

413, 613

Assistance provided: reports use of null pointers including those which could be returned when a call to an allocation function fails

Polyspace Bug Finder

Include Page
Polyspace Bug Finder_V
Polyspace Bug Finder_V

CERT C: Rec. MEM11-C


Checks for unprotected dynamic memory allocation (rule partially covered)

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

Related Guidelines

...


...

Image Modified Image Modified Image Modified