CWE-1235: Incorrect Use of Autoboxing and Unboxing for Performance Critical Operations
CWE版本: 4.18
更新日期: 2025-09-09
弱点描述
The code uses boxed primitives, which may introduce inefficiencies into performance-critical operations.
常见后果
影响范围: 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.
潜在缓解措施
阶段: Implementation
描述: 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.
引入模式
| 阶段 | 说明 |
|---|---|
| Implementation | The programmer may use boxed primitives when not strictly necessary. |
适用平台
编程语言
操作系统
技术
分类映射
| 分类名称 | 条目ID | 条目名称 | 映射适配度 |
|---|---|---|---|
| SEI CERT Oracle Coding Standard for Java | EXP04-J | Do not pass arguments to certain Java Collections Framework methods that are a different type than the collection parameter type | - |
| ISA/IEC 62443 | Part 4-1 | Req SI-2 | - |