#229: Integer overflow in array allocation
-----------------------------+----------------------------------------------
Reporter: josefs | Owner:
Type: bug | Status: closed
Priority: low | Milestone: _|_
Component: libraries/base | Version: 6.4.1
Resolution: fixed | Keywords:
Difficulty: Unknown | Os: Unknown/Multiple
Testcase: | Architecture: Unknown/Multiple
Failure: None/Unknown |
-----------------------------+----------------------------------------------
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.
{{{
\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'.
Comment (by josef):
Using the bounds (minInt,maxInt) was probably the wrong thing todo. My
concern when filing the bug report was not the arithmetic overflow but the
fact that ghci crashes when it tries to allocate a too large an array. It
is still possible to provoke a crash if you change the array bounds to,
say, (2,maxInt). Should I open a new ticket or reopen this one?
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/229#comment:13>
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