From 526e0474f7038f4a8a6e1ba8972b1014316058b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Tue, 22 May 2018 08:17:12 +0200 Subject: 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. --- lib/compiler/src/beam_validator.erl | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/compiler/src/beam_validator.erl') 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}, -- cgit v1.2.3