aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-05-22 08:17:12 +0200
committerBjörn Gustavsson <[email protected]>2018-08-17 09:50:58 +0200
commit526e0474f7038f4a8a6e1ba8972b1014316058b5 (patch)
tree274334ffdf9ccd75eca733a1eefd325b9069624d
parent382297819ece0518a0e94b484c8ed8cb25e507c7 (diff)
downloadotp-526e0474f7038f4a8a6e1ba8972b1014316058b5.tar.gz
otp-526e0474f7038f4a8a6e1ba8972b1014316058b5.tar.bz2
otp-526e0474f7038f4a8a6e1ba8972b1014316058b5.zip
beam_validator: Strengthen validation of func_info
The func_info instruction does not expect a stack frame. There will be an assertion failure in the debug-compiled runtime system.
-rw-r--r--lib/compiler/src/beam_validator.erl6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl
index 57b5083c1f..1c1c02cf15 100644
--- a/lib/compiler/src/beam_validator.erl
+++ b/lib/compiler/src/beam_validator.erl
@@ -204,6 +204,12 @@ validate_fun_info_branches([], _, _) -> ok.
validate_fun_info_branches_1(Arity, {_,_,Arity}, _) -> ok;
validate_fun_info_branches_1(X, {Mod,Name,Arity}=MFA, Vst) ->
try
+ case Vst of
+ #vst{current=#st{numy=none}} ->
+ ok;
+ #vst{current=#st{numy=Size}} ->
+ error({unexpected_stack_frame,Size})
+ end,
get_term_type({x,X}, Vst)
catch Error ->
I = {func_info,{atom,Mod},{atom,Name},Arity},