You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use Int in a lot of places, but Haskell only guarantees 29 bits, and 28 bits of positive integers, or referring up to 256MB.
We should consider using Int64 instead of relying on having >28bits.
Wops, Haskell guarantees 30 bits, so 29bits of positive integers or 512MB.
There are several haskell compilers and interpreters, and I'm not sure all of them use 32bits. In practice though, I think most people use GHC - meaning 32bits. We also only do testing with GHC.
This request came from Henning Thielemann wishing for skip64.
I do not have a concrete misbehavior of the 'binary' package, but I am concerned in general that some functions use Int and others use Int64. There is always an architecture where conversion between Int and Int32 or Int64 may overflow. Maybe it is even possible to use such overflows for hacker attacks. Thus it is certainly a good idea to use one integer type consistently.
Activity
tibbe commentedon Apr 16, 2014
I think it's safe to assume 32-bits. All Haskell compilers use that. ;)
kolmodin commentedon Apr 16, 2014
Wops, Haskell guarantees 30 bits, so 29bits of positive integers or 512MB.
There are several haskell compilers and interpreters, and I'm not sure all of them use 32bits. In practice though, I think most people use GHC - meaning 32bits. We also only do testing with GHC.
This request came from Henning Thielemann wishing for
skip64.To be fair, we already do plenty of assumptions about Int sizes. The
binaryinstance ofIntalways writes aIntas if it wasInt64but will on a 32bit machine convert that into 32bits when it's decoded.https://github.com/kolmodin/binary/blob/master/src/Data/Binary/Class.hs#L181
amigalemming commentedon Apr 16, 2014
I do not have a concrete misbehavior of the 'binary' package, but I am concerned in general that some functions use Int and others use Int64. There is always an architecture where conversion between Int and Int32 or Int64 may overflow. Maybe it is even possible to use such overflows for hacker attacks. Thus it is certainly a good idea to use one integer type consistently.