aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorAnthony Ramine <[email protected]>2013-08-01 02:03:39 +0200
committerAnthony Ramine <[email protected]>2013-08-01 02:04:25 +0200
commiteaeea8dbde10e5e0a1c65bfd093ae18398b400d0 (patch)
tree6abf72d7adb389845c03a27ba66a6ce44feb08ae /lib/compiler/src
parenta938fc96881564f5f56a510b0c750efaa9ed48e4 (diff)
downloadotp-eaeea8dbde10e5e0a1c65bfd093ae18398b400d0.tar.gz
otp-eaeea8dbde10e5e0a1c65bfd093ae18398b400d0.tar.bz2
otp-eaeea8dbde10e5e0a1c65bfd093ae18398b400d0.zip
Forbid returning a match context in beam_validator
If a match context is returned from a function without being converted back to a plain old binary, the whole VM will crash.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/beam_validator.erl1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl
index eb72290306..70279ab658 100644
--- a/lib/compiler/src/beam_validator.erl
+++ b/lib/compiler/src/beam_validator.erl
@@ -628,6 +628,7 @@ valfun_4({gc_bif,Op,{f,Fail},Live,Src,Dst}, #vst{current=St0}=Vst0) ->
Type = bif_type(Op, Src, Vst),
set_type_reg(Type, Dst, Vst);
valfun_4(return, #vst{current=#st{numy=none}}=Vst) ->
+ assert_term({x,0}, Vst),
kill_state(Vst);
valfun_4(return, #vst{current=#st{numy=NumY}}) ->
error({stack_frame,NumY});