CWE-1235 – Incorrect Use of Autoboxing and Unboxing for Performance Critical Operations

Read Time:31 Second

Description

The code uses boxed primitives, which may introduce inefficiencies into performance-critical operations.

Modes of Introduction:

– Implementation

 

 

Related Weaknesses

CWE-400

 

Consequences

Availability: DoS: Resource Consumption (CPU), DoS: Resource Consumption (Memory), DoS: Resource Consumption (Other), Reduce Performance

Incorrect autoboxing/unboxing would result in reduced performance, which sometimes can lead to resource consumption issues.

 

Potential Mitigations

Phase: Implementation

Description: 

Use of boxed primitives should be limited to certain situations such as when calling methods with typed parameters. Examine the use of boxed primitives prior to use. Use SparseArrays or ArrayMap instead of HashMap to avoid performance overhead.

CVE References