diff options
author | Henrik Nord <[email protected]> | 2015-03-12 12:09:11 +0100 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2015-03-12 12:09:14 +0100 |
commit | 79739d9567f72e7fe725509912ec676ea955ab64 (patch) | |
tree | 6cf5bf6c4efbbf2b641f83a5e64e7f26dbe3885c /erts/emulator/beam/erl_bits.c | |
parent | 0796cb716511ae2bf35ee0ee1e0da75f20ad567f (diff) | |
parent | 7f82fdee75c2c3c3c5eaf259e2671737163be32b (diff) | |
download | otp-79739d9567f72e7fe725509912ec676ea955ab64.tar.gz otp-79739d9567f72e7fe725509912ec676ea955ab64.tar.bz2 otp-79739d9567f72e7fe725509912ec676ea955ab64.zip |
Merge branch 'mikpe/avoid-oversize-bignums' into maint
* mikpe/avoid-oversize-bignums:
don't leave a heap hole in erts_bs_get_integer_2
don't create oversize bignums in binary matching
OTP-12556
Diffstat (limited to 'erts/emulator/beam/erl_bits.c')
-rw-r--r-- | erts/emulator/beam/erl_bits.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_bits.c b/erts/emulator/beam/erl_bits.c index 73765772c8..53c21c40e1 100644 --- a/erts/emulator/beam/erl_bits.c +++ b/erts/emulator/beam/erl_bits.c @@ -403,7 +403,10 @@ erts_bs_get_integer_2(Process *p, Uint num_bits, unsigned flags, ErlBinMatchBuff words_needed = 1+WSIZE(bytes); hp = HeapOnlyAlloc(p, words_needed); res = bytes_to_big(LSB, bytes, sgn, hp); - if (is_small(res)) { + if (is_nil(res)) { + p->htop = hp; + res = THE_NON_VALUE; + } else if (is_small(res)) { p->htop = hp; } else if ((actual = bignum_header_arity(*hp)+1) < words_needed) { p->htop = hp + actual; |