Katalog CWE

CWE-1077 · Słabość

Floating Point Comparison with Incorrect Operator

Abstrakcja
Wariant
Status
Niekompletny
Dodano
2 lipca 2018
Ostatnia zmiana
11 grudnia 2025

Podatności CVE z tą słabościąPełny wpis na cwe.mitre.org ↗

Opis

The code performs a comparison such as an equality test between two float (floating point) values, but it uses comparison operators that do not account for the possibility of loss of precision.

Numeric calculation using floating point values can generate imprecise results because of rounding errors. As a result, two different calculations might generate numbers that are mathematically equal, but have slightly different bit representations that do not translate to the same mathematically-equal values. As a result, an equality test or other comparison might produce unexpected results.

Skutki

  • Other

    Reduce Reliability

    This issue can prevent the product from running reliably. If the relevant code is reachable by an attacker, then this reliability problem might introduce a vulnerability.

Słabość nadrzędna

Kiedy powstaje

Dotyczy

Not Language-Specific

Źródła

  1. Automated Source Code Reliability Measure (ASCRM) — Object Management Group (OMG), ASCRM-RLB-9, 2016
  2. Comparing Floating Point Numbers, 2012 Edition — Bruce Dawson, 2012

Wpis z katalogu CWE 4.20.