[GHC] #14850: mallocBytes allows underflow

GHC ghc-devs at haskell.org
Sun Feb 25 02:13:40 UTC 2018


#14850: mallocBytes allows underflow
-------------------------------------+-------------------------------------
           Reporter:  wyager         |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:                 |           Version:  8.0.2
  libraries/base                     |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Poor/confusing
  Unknown/Multiple                   |  error message
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 https://hackage.haskell.org/package/base-4.10.1.0/docs/src/Foreign.Marshal.Alloc.html#mallocBytes

 This function doesn't complain when passed a negative number. Instead you
 get something like

 `*** Exception: malloc: resource exhausted (out of memory)`

 Which is confusing, and probably not consistent across platforms.

 This came up in https://github.com/tel/saltine/issues/42

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


More information about the ghc-tickets mailing list