Détail du CWE-1339

CWE-1339

Insufficient Precision or Accuracy of a Real Number
Draft
2021-07-20
00h00 +00:00
2025-12-11
00h00 +00:00
Notifications pour un CWE
Restez informé de toutes modifications pour un CWE spécifique.
Gestion des notifications

Nom: Insufficient Precision or Accuracy of a Real Number

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.

Informations générales

Informations de base

There are three major ways to store real numbers in computers. Each method is described along with the limitations of how they store their numbers.

Modes d'introduction

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.

Plateformes applicables

Langue

Class: Not Language-Specific (Undetermined)

Systèmes d’exploitation

Class: Not OS-Specific (Undetermined)

Architectures

Class: Not Architecture-Specific (Undetermined)

Technologies

Class: Not Technology-Specific (Undetermined)

Conséquences courantes

Portée Impact Probabilité
AvailabilityDoS: Crash, Exit, or Restart

Note: 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.
IntegrityExecute Unauthorized Code or Commands

Note: 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

Note: 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.

Exemples observés

Références Description

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]"

Mesures d’atténuation potentielles

Phases : 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.

Méthodes de détection

Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

Notes de cartographie des vulnérabilités

Justification : This CWE entry is at the Base level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.
Commentaire : Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.

Références

REF-1186

Is COBOL holding you hostage with Math?
https://medium.com/the-technical-archaeologist/is-cobol-holding-you-hostage-with-math-5498c0eb428b

REF-1187

Intermediate results and arithmetic precision
https://www.ibm.com/docs/en/cobol-zos/6.2?topic=appendixes-intermediate-results-arithmetic-precision

REF-1188

8.1.2. Arbitrary Precision Numbers
https://www.postgresql.org/docs/8.3/datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL

REF-1189

Muller's Recurrence
https://scipython.com/blog/mullers-recurrence/

REF-1190

An Improvement To Floating Point Numbers
https://hackaday.com/2015/10/22/an-improvement-to-floating-point-numbers/

REF-1191

HIGH PERFORMANCE COMPUTING: ARE WE JUST GETTING WRONG ANSWERS FASTER?
https://www3.nd.edu/~markst/cast-award-speech.pdf

Soumission

Nom Organisation Date Date de publication Version
CWE Content Team MITRE 2021-07-08 +00:00 2021-07-20 +00:00 4.5

Modifications

Nom Organisation Date Commentaire
CWE Content Team MITRE 2022-10-13 +00:00 updated Demonstrative_Examples
CWE Content Team MITRE 2023-01-31 +00:00 updated Common_Consequences, Description, Potential_Mitigations
CWE Content Team MITRE 2023-04-27 +00:00 updated References, Relationships
CWE Content Team MITRE 2023-06-29 +00:00 updated Mapping_Notes
CWE Content Team MITRE 2024-02-29 +00:00 updated Demonstrative_Examples
CWE Content Team MITRE 2025-04-03 +00:00 updated Demonstrative_Examples
CWE Content Team MITRE 2025-12-11 +00:00 updated Detection_Factors, Weakness_Ordinalities