#7052: Numeric types’ Read instances use exponential CPU/memory
-------------------------------------+--------------------------------------
 Reporter:  andersk                  |          Owner:                  
     Type:  bug                      |         Status:  new             
 Priority:  normal                   |      Component:  libraries/base  
  Version:  7.4.2                    |       Keywords:                  
       Os:  Unknown/Multiple         |   Architecture:  Unknown/Multiple
  Failure:  Runtime performance bug  |       Testcase:                  
Blockedby:                           |       Blocking:                  
  Related:                           |  
-------------------------------------+--------------------------------------
 Computing
   read "1e99999999" :: Int      -- returns 0
   read "1e99999999" :: Integer  -- returns [REDACTED]
   read "1e99999999" :: Float    -- returns Infinity
   read "1e99999999" :: Double   -- returns Infinity
 takes rather a lot of CPU time and memory, and adding more digits to the
 exponent makes it take exponentially more.  In some applications, this
 behavior could be exploitable as a denial of service.

 I’m not sure what the right solution is for Integer, but clearly all the
 other cases should be optimized to produce 0 or Infinity very quickly.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7052>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to