diff options
author | Björn Gustavsson <[email protected]> | 2014-02-06 10:08:15 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2014-02-06 10:08:15 +0100 |
commit | 503b0769e647f06b15b8d5e5fd09f3b2ab10ebfa (patch) | |
tree | 639a5d81f85ffc83f5023f4b0d4ae04c2882e178 /lib/compiler/src | |
parent | 3efa33db1e59b400babf672b07763c4a2467798a (diff) | |
parent | 5f4b495e68de1d1762cad0a96d01b5195d3b458e (diff) | |
download | otp-503b0769e647f06b15b8d5e5fd09f3b2ab10ebfa.tar.gz otp-503b0769e647f06b15b8d5e5fd09f3b2ab10ebfa.tar.bz2 otp-503b0769e647f06b15b8d5e5fd09f3b2ab10ebfa.zip |
Merge branch 'bjorn/compiler/applying-binary-crash/OTP-11672'
* bjorn/compiler/applying-binary-crash/OTP-11672:
beam_bsm: Eliminate emulator crash when a binary is called
beam_validator: Validate the "fun" argument for a call_fun/1 instruction
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/beam_bsm.erl | 1 | ||||
-rw-r--r-- | lib/compiler/src/beam_validator.erl | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_bsm.erl b/lib/compiler/src/beam_bsm.erl index fdfcb08125..d54c2a9fde 100644 --- a/lib/compiler/src/beam_bsm.erl +++ b/lib/compiler/src/beam_bsm.erl @@ -209,6 +209,7 @@ btb_reaches_match_2([{call,Arity,{f,Lbl}}|Is], Regs, D) -> btb_reaches_match_2([{apply,Arity}|Is], Regs, D) -> btb_call(Arity+2, apply, Regs, Is, D); btb_reaches_match_2([{call_fun,Live}=I|Is], Regs, D) -> + btb_ensure_not_used([{x,Live}], I, Regs), btb_call(Live, I, Regs, Is, D); btb_reaches_match_2([{make_fun2,_,_,_,Live}|Is], Regs, D) -> btb_call(Live, make_fun2, Regs, Is, D); diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl index 97f84da08f..682f7adbc2 100644 --- a/lib/compiler/src/beam_validator.erl +++ b/lib/compiler/src/beam_validator.erl @@ -574,6 +574,7 @@ valfun_4({apply,Live}, Vst) -> valfun_4({apply_last,Live,_}, Vst) -> tail_call(apply, Live+2, Vst); valfun_4({call_fun,Live}, Vst) -> + validate_src([{x,Live}], Vst), call('fun', Live+1, Vst); valfun_4({call,Live,Func}, Vst) -> call(Func, Live, Vst); |