[erlang-bugs] 2#1 bsl N Crashes Erlang (x86_64)

Bjorn Gustavsson bgustavsson@REDACTED
Tue Feb 3 10:07:48 CET 2009


On Sun, Feb 1, 2009 at 10:31 AM, Daniel Hedlund <daniel@REDACTED> wrote:
> This bug affects x86_64 implementations.  Not sure if it's OS specific
> or affects other 64-bit architectures.  2#1 bsl N crashes Erlang when
> N is larger than available memory but lower than 2^59.  Above 2^59, a
> bad argument exception occurs.
>
> It appears there's supposed to be a check that prevents insanely large
> values of N, starting at 2^25-64 (64-bit) and 2^24-32 (32-bit); at
> this point it starts returning "a system limit has been reached".  On
> 32-bit systems, this check works all the way up through the bad
> argument exception mentioned above.  On 64-bit, this check stops
> working where 2^34 < N < 2^35; it begins attempting to allocate memory
> again, eventually crashing.
>

Thanks for the bug report.

The problem was that memory was allocated before attempting to evaluate
the 'bsl' operation. I have now added an additional test to generate an
exception before the allocation if the amount is clearly too much.

We also discovered a few additional minor bugs when examining the code.

The corrections will be included in R13.

/Bjorn

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-bugs mailing list