diff options
author | Björn Gustavsson <[email protected]> | 2011-05-10 10:56:24 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2011-08-03 11:24:52 +0200 |
commit | e8becad96454a8deb755f587ca0daaf96dfca90e (patch) | |
tree | 40ba945786f497611441f5a13f07efdf2e210879 /erts/emulator/test | |
parent | 07936436b8a8b18b80451a09e040283ebecbd43b (diff) | |
download | otp-e8becad96454a8deb755f587ca0daaf96dfca90e.tar.gz otp-e8becad96454a8deb755f587ca0daaf96dfca90e.tar.bz2 otp-e8becad96454a8deb755f587ca0daaf96dfca90e.zip |
Fix construction of <<0:((1 bsl 32)-1)>>
Attempting to construct <<0:((1 bsl 32)-1)>>, the largest bitstring
allowed in a 32 bit emulator, would cause an emulator crash because
of integer overflow.
Fix the problem by using an Uint64 to avoid integer overflow.
Do not attempt to handle construction of <<0:((1 bsl 64)-1>> in
a 64-bit emulator, because that will certainly cause the emulator
to terminate anyway because of insufficient memory.
Diffstat (limited to 'erts/emulator/test')
-rw-r--r-- | erts/emulator/test/bs_construct_SUITE.erl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/erts/emulator/test/bs_construct_SUITE.erl b/erts/emulator/test/bs_construct_SUITE.erl index 1959803385..ef5940d748 100644 --- a/erts/emulator/test/bs_construct_SUITE.erl +++ b/erts/emulator/test/bs_construct_SUITE.erl @@ -553,6 +553,11 @@ huge_float_check({'EXIT',{badarg,_}}) -> ok. huge_binary(Config) when is_list(Config) -> ?line 16777216 = size(<<0:(id(1 bsl 26)),(-1):(id(1 bsl 26))>>), + ?line garbage_collect(), + ?line id(<<0:((1 bsl 32)-1)>>), + ?line garbage_collect(), + ?line id(<<0:(id((1 bsl 32)-1))>>), + ?line garbage_collect(), ok. system_limit(Config) when is_list(Config) -> |