diff options
author | Björn Gustavsson <[email protected]> | 2012-08-15 11:05:30 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2012-08-15 11:05:30 +0200 |
commit | c5e5cf792d87e0d23f80ff572f499f0e3e044933 (patch) | |
tree | 585bc144e76486ed0959e4675015fbb760c6c33c /lib/compiler/src/beam_validator.erl | |
parent | 9492bf7abbf5e43a9bdada5b0ace0432ce1f4223 (diff) | |
parent | 6cdc6b667a8db2b63a4613c63dc4f75a34a5ea7f (diff) | |
download | otp-c5e5cf792d87e0d23f80ff572f499f0e3e044933.tar.gz otp-c5e5cf792d87e0d23f80ff572f499f0e3e044933.tar.bz2 otp-c5e5cf792d87e0d23f80ff572f499f0e3e044933.zip |
Merge branch 'bjorn/compiler/minor-fixes/OTP-10185' into maint
* bjorn/compiler/minor-fixes/OTP-10185:
erl_lint: Add a deprecated warning for literal tuple funs
beam_utils:live_opt/1: Correct handling of try_case_end/1
Correct guard_SUITE_tuple_size.S
beam_type: Print the offending function if this pass crashes
beam_validator: Validate the size operand in bs_init_bits and bs_init2
Diffstat (limited to 'lib/compiler/src/beam_validator.erl')
-rw-r--r-- | lib/compiler/src/beam_validator.erl | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl index a52e7bb761..9f0bca9dd5 100644 --- a/lib/compiler/src/beam_validator.erl +++ b/lib/compiler/src/beam_validator.erl @@ -783,15 +783,27 @@ valfun_4({bs_utf16_size,{f,Fail},A,Dst}, Vst) -> valfun_4({bs_bits_to_bytes,{f,Fail},Src,Dst}, Vst) -> assert_term(Src, Vst), set_type_reg({integer,[]}, Dst, branch_state(Fail, Vst)); -valfun_4({bs_init2,{f,Fail},_,Heap,Live,_,Dst}, Vst0) -> +valfun_4({bs_init2,{f,Fail},Sz,Heap,Live,_,Dst}, Vst0) -> verify_live(Live, Vst0), + if + is_integer(Sz) -> + ok; + true -> + assert_term(Sz, Vst0) + end, Vst1 = heap_alloc(Heap, Vst0), Vst2 = branch_state(Fail, Vst1), Vst3 = prune_x_regs(Live, Vst2), Vst = bs_zero_bits(Vst3), set_type_reg(binary, Dst, Vst); -valfun_4({bs_init_bits,{f,Fail},_,Heap,Live,_,Dst}, Vst0) -> +valfun_4({bs_init_bits,{f,Fail},Sz,Heap,Live,_,Dst}, Vst0) -> verify_live(Live, Vst0), + if + is_integer(Sz) -> + ok; + true -> + assert_term(Sz, Vst0) + end, Vst1 = heap_alloc(Heap, Vst0), Vst2 = branch_state(Fail, Vst1), Vst3 = prune_x_regs(Live, Vst2), |