Skip to content

No parameter-validation in Control.Concurrent.setNumCapabilities

> ghci
GHCi, version 7.6.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> Control.Concurrent.setNumCapabilities $ negate 1
malloc: failed on request for 18446744073709551104 bytes; message: moreCapabilities

The parameter is forwarded to the underlying C-function without validation, the runtime then crashes; no exception is thrown. This behaviour also exists in ghc 8.0.2

Edited by Ben Gamari
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information