CWE-674

Uncontrolled Recursion
AI Translation Available

The product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack.

Status
draft
Abstraction
class

Common Consequences

availability confidentiality
Impacts
dos: resource consumption (cpu) dos: resource consumption (memory) read application data

Detection Methods

automated static analysis

Potential Mitigations

Phases:
implementation
Descriptions:
• Ensure an end condition will be reached under all logic conditions. The end condition may include testing against the depth of recursion and exiting with an error if the recursion goes too deep. The complexity of the end condition contributes to the effectiveness of this action.
• Increase the stack size.