[GHC] #5688: instance Read Integer/Rational/Double readsPrec out of memory and crash due to exponential notation
GHC
cvs-ghc at haskell.org
Fri Mar 2 13:01:29 CET 2012
#5688: instance Read Integer/Rational/Double readsPrec out of memory and crash due
to exponential notation
-------------------------------+--------------------------------------------
Reporter: gracjan | Owner: igloo
Type: bug | Status: new
Priority: highest | Milestone: 7.4.2
Component: libraries/base | Version: 6.12.3
Resolution: | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: Runtime crash | Difficulty: Unknown
Testcase: | Blockedby:
Blocking: | Related:
-------------------------------+--------------------------------------------
Comment(by maeder):
The precise number given by the input string needs to be converted to the
nearest representable number (by the round-to-nearest rule of IEEE 754
floating-point arithmetic).
If we assume that `fromRational` does this correctly, it is enough to
roughly estimate when the value will definitely be +/- Infinity/Zero (in
order to avoid computing an overly large Rational value causing this
ticket).
Roughly estimating makes failing inconsistent (at least not precise).
It remains to check, if `fromRational` does the right thing. I assume it
replaces "%" by "/" and converts the two arguments from Integer to
Double/Float first. (Where is the code for this?)
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5688#comment:47>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list