diff options
author | Magnus Lång <[email protected]> | 2015-11-20 17:43:51 +0100 |
---|---|---|
committer | Magnus Lång <[email protected]> | 2015-11-27 18:18:38 +0100 |
commit | 01442bb8d4d1f62f8a4f95d5b89bda725bf1423d (patch) | |
tree | 9e0c4cd3751c1dbf7cb0eaba4560da4c4cb35231 /lib/hipe/icode/hipe_icode_range.erl | |
parent | d5a877aeb8e7845bf92469456a8246cb62cd7036 (diff) | |
download | otp-01442bb8d4d1f62f8a4f95d5b89bda725bf1423d.tar.gz otp-01442bb8d4d1f62f8a4f95d5b89bda725bf1423d.tar.bz2 otp-01442bb8d4d1f62f8a4f95d5b89bda725bf1423d.zip |
hipe: Guard against enormous numbers in ranges
This allows us to compile bs_match_int_SUITE with HiPE without a
system_limit crash.
Diffstat (limited to 'lib/hipe/icode/hipe_icode_range.erl')
-rw-r--r-- | lib/hipe/icode/hipe_icode_range.erl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/hipe/icode/hipe_icode_range.erl b/lib/hipe/icode/hipe_icode_range.erl index ba5fa1bfd7..9a20527a83 100644 --- a/lib/hipe/icode/hipe_icode_range.erl +++ b/lib/hipe/icode/hipe_icode_range.erl @@ -1202,11 +1202,11 @@ basic_type(#unsafe_update_element{}) -> not_analysed. analyse_bs_get_integer(Size, Flags, true) -> Signed = Flags band 4, if Signed =:= 0 -> - Max = 1 bsl Size - 1, + Max = inf_add(inf_bsl(1, Size), -1), Min = 0; true -> - Max = 1 bsl (Size-1) - 1, - Min = -(1 bsl (Size-1)) + Max = inf_add(inf_bsl(1, Size-1), -1), + Min = inf_inv(inf_bsl(1, Size-1)) end, {Min, Max}; analyse_bs_get_integer(Size, Flags, false) when is_integer(Size), |