CWE-1339: Insufficient Precision or Accuracy of a Real Number

Base Draft Simple

CWE版本: 4.18

更新日期: 2025-09-09

弱点描述

The product processes a real number with an implementation in which the number's representation does not preserve required accuracy and precision in its fractional part, causing an incorrect result.

常见后果

影响范围: Availability

技术影响: DoS: Crash, Exit, or Restart

说明: This weakness will generally lead to undefined results and therefore crashes. In some implementations the program will halt if the weakness causes an overflow during a calculation.

影响范围: Integrity

技术影响: Execute Unauthorized Code or Commands

说明: The results of the math are not as expected. This could cause issues where a value would not be properly calculated and provide an incorrect answer.

影响范围: Confidentiality Availability Access Control

技术影响: Read Application Data Modify Application Data

说明: This weakness can sometimes trigger buffer overflows which can be used to execute arbitrary code. This is usually outside the scope of a product's implicit security policy.

潜在缓解措施

阶段: Implementation Patching and Maintenance

描述: The developer or maintainer can move to a more accurate representation of real numbers. In extreme cases, the programmer can move to representations such as ratios of BigInts which can represent real numbers to extremely fine precision. The programmer can also use the concept of an Unum real. The memory and CPU tradeoffs of this change must be examined. Since floating point reals are used in many products and many locations, they are implemented in hardware and most format changes will cause the calculations to be moved into software resulting in slower products.

观察示例

参考: CVE-2018-16069

Chain: series of floating-point precision errors (CWE-1339) in a web browser rendering engine causes out-of-bounds read (CWE-125), giving access to cross-origin data

参考: CVE-2017-7619

Chain: rounding error in floating-point calculations (CWE-1339) in image processor leads to infinite loop (CWE-835)

参考: CVE-2021-29529

Chain: machine-learning product can have a heap-based buffer overflow (CWE-122) when some integer-oriented bounds are calculated by using ceiling() and floor() on floating point values (CWE-1339)

参考: CVE-2008-2108

Chain: insufficient precision (CWE-1339) in random-number generator causes some zero bits to be reliably generated, reducing the amount of entropy (CWE-331)

参考: CVE-2006-6499

Chain: web browser crashes due to infinite loop - "bad looping logic [that relies on] floating point math [CWE-1339] to exit the loop [CWE-835]"

引入模式

阶段 说明
Implementation This weakness is introduced when the developer picks a method to represent a real number. The weakness may only be visible with very specific numeric inputs.

适用平台

编程语言
Not Language-Specific (Undetermined)
操作系统
Not OS-Specific (Undetermined)
技术
Not Technology-Specific (Undetermined)
关键信息

CWE ID: CWE-1339

抽象级别: Base

结构: Simple

状态: Draft

相关弱点