[GHC] #229: Integer overflow in array allocation

GHC ghc-devs at haskell.org
Fri Dec 4 01:15:50 UTC 2015


#229: Integer overflow in array allocation
-------------------------------------+-------------------------------------
        Reporter:  josefs            |                Owner:  rwbarton
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.0.1
       Component:  Core Libraries    |              Version:  7.9
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by bgamari):

 * cc: ekmett (added)


Old description:

> When asked to create a sufficiently large array ghci
> coredumps.
>
> {{{
> \begin{code}
> import Data.Array.ST
> import Control.Monad.ST
> import GHC.Base
>
> example = runST (do arr <- newArray (minInt,maxInt)
> False
>                     go arr)
>   where go :: STArray s Int Bool -> ST s Bool
>         go arr = readArray arr 3
> \end{code}
> }}}
>
> Load this into ghci and type 'example'.

New description:

 When asked to create a sufficiently large array ghci
 coredumps.

 {{{#!hs
 import Data.Array.ST
 import Control.Monad.ST
 import GHC.Base

 example = runST (do arr <- newArray (minInt,maxInt) False
                     go arr)
   where go :: STArray s Int Bool -> ST s Bool
         go arr = readArray arr 3
 }}}

 Load this into ghci and type 'example'.

--

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/229#comment:24>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list