Every CVE Search/ Get API key

HSEC-2023-0007

readFloat: memory exhaustion with large exponent

No scoreFix available

readFloat: memory exhaustion with large exponent

Numeric.readFloat takes time and memory linear in the size of the number denoted by the input string. In particular, processing a number expressed in scientific notation with a very large exponent could cause a denial of service. The slowdown is observable on a modern machine running GHC 9.4.4:

ghci> import qualified Numeric
ghci> Numeric.readFloat "1e1000000"    -- near instantaneous
[(Infinity,"")]
ghci> Numeric.readFloat "1e10000000"   -- perceptible pause
[(Infinity,"")]
ghci> Numeric.readFloat "1e100000000"  -- ~ 3 seconds
[(Infinity,"")]
ghci> Numeric.readFloat "1e1000000000" -- ~ 35 seconds
[(Infinity,"")]

In base

Numeric.readFloat is defined for all RealFrac a => a:

readFloat :: RealFrac a => ReadS a

The RealFrac type class does not express any bounds on the size of values representable in the types for which instances exist, so bounds checking is not possible (in this generic function). readFloat uses to Text.Read.Lex.numberToRational which, among other things, calculates 10 ^ exponent, which seems to take linear time and memory.

Mitigation: use read. The Read instances for Float and Double perform bounds checks on the exponent, via Text.Read.Lex.numberToRangedRational.

In toml-reader

The issue was detected in toml-reader version 0.1.0.0, and mitigated in version 0.2.0.0 by immediately returning Infinity when the exponent is large enough that there's no reason to process it.

What each source reports

OSV No score

readFloat: memory exhaustion with large exponent

readFloat: memory exhaustion with large exponent

Numeric.readFloat takes time and memory linear in the size of the number denoted by the input string. In particular, processing a number expressed in scientific notation with a very large exponent could cause a denial of service. The slowdown is observable on a modern machine running GHC 9.4.4:

ghci> import qualified Numeric
ghci> Numeric.readFloat "1e1000000"    -- near instantaneous
[(Infinity,"")]
ghci> Numeric.readFloat "1e10000000"   -- perceptible pause
[(Infinity,"")]
ghci> Numeric.readFloat "1e100000000"  -- ~ 3 seconds
[(Infinity,"")]
ghci> Numeric.readFloat "1e1000000000" -- ~ 35 seconds
[(Infinity,"")]

In base

Numeric.readFloat is defined for all RealFrac a => a:

readFloat :: RealFrac a => ReadS a

The RealFrac type class does not express any bounds on the size of values representable in the types for which instances exist, so bounds checking is not possible (in this generic function). readFloat uses to Text.Read.Lex.numberToRational which, among other things, calculates 10 ^ exponent, which seems to take linear time and memory.

Mitigation: use read. The Read instances for Float and Double perform bounds checks on the exponent, via Text.Read.Lex.numberToRangedRational.

In toml-reader

The issue was detected in toml-reader version 0.1.0.0, and mitigated in version 0.2.0.0 by immediately returning Infinity when the exponent is large enough that there's no reason to process it.

Record
HSEC-2023-0007
Updated
2026-11-02

Affected packages

Affected packages
PackageAffectedFixed
base
Hackage
3.0.3.1 and later, plus listed versions
3.0.3.24.0.0.04.1.0.04.10.0.04.10.1.0
Show 45 moreShow less
4.11.0.04.11.1.04.12.0.04.13.0.04.14.0.04.14.1.04.14.2.04.14.3.04.15.0.04.15.1.04.16.0.04.16.1.04.16.2.04.16.3.04.16.4.04.17.0.04.17.1.04.17.2.04.17.2.14.18.0.04.18.1.04.18.2.04.18.2.14.18.3.04.19.0.04.19.1.04.19.2.04.2.0.04.2.0.14.2.0.24.20.0.04.20.0.14.20.1.04.20.2.04.21.0.04.21.1.04.21.2.04.22.0.04.3.0.04.3.1.04.4.0.04.4.1.04.5.0.04.5.1.04.6.0.0
None known
toml-reader
Hackage
0.1.0.0 up to 0.2.0.0
0.2.0.0

History

History
RecordedChangedSources
first indexedOSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

HSEC-2023-0007 is a vulnerability with no CVSS score yet in base, published November 14, 2025. No source lists public exploit code. Fixed in toml-reader 0.2.0.0.

References

This page doesn't list everything

Left out here: 9 versions. The JSON record has them.

MoveEnter Open