diff options
author | Björn Gustavsson <[email protected]> | 2014-02-05 17:28:02 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2014-02-05 17:45:56 +0100 |
commit | 5f4b495e68de1d1762cad0a96d01b5195d3b458e (patch) | |
tree | 958127b54e582dc330ef1dde1ed0d859e734fc35 /lib/compiler/src/beam_bsm.erl | |
parent | df4932103f0e7b848e094ed56b1fc042f896cf8f (diff) | |
download | otp-5f4b495e68de1d1762cad0a96d01b5195d3b458e.tar.gz otp-5f4b495e68de1d1762cad0a96d01b5195d3b458e.tar.bz2 otp-5f4b495e68de1d1762cad0a96d01b5195d3b458e.zip |
beam_bsm: Eliminate emulator crash when a binary is called
We must not do the delayed binary creation optimization if the
code attempts to call the matched out binary. Calling a matchstate
will crash the run-time system.
Reported-by: Loïc Hoguin
Diffstat (limited to 'lib/compiler/src/beam_bsm.erl')
-rw-r--r-- | lib/compiler/src/beam_bsm.erl | 1 |
1 files changed, 1 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); |