diff options
author | Björn Gustavsson <[email protected]> | 2018-04-26 22:23:04 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2018-04-27 10:20:41 +0200 |
commit | 84150137640481ac139325bf8cc665dd47fca95c (patch) | |
tree | de995437272eeb9d736326011eafe5d564f6e3a8 /lib/compiler/src | |
parent | 9b347a42a23540eab2f3fd8bf75190a69b5ebb31 (diff) | |
download | otp-84150137640481ac139325bf8cc665dd47fca95c.tar.gz otp-84150137640481ac139325bf8cc665dd47fca95c.tar.bz2 otp-84150137640481ac139325bf8cc665dd47fca95c.zip |
beam_validator: Verify Y registers in exception-causing instructions
When an exception is handled, the stack will be scanned. Therefore
all Y registers must be initialized.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/beam_validator.erl | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl index 962f17d83c..86aa12e19b 100644 --- a/lib/compiler/src/beam_validator.erl +++ b/lib/compiler/src/beam_validator.erl @@ -267,13 +267,17 @@ valfun_1(_I, #vst{current=none}=Vst) -> Vst; valfun_1({badmatch,Src}, Vst) -> assert_term(Src, Vst), + verify_y_init(Vst), kill_state(Vst); valfun_1({case_end,Src}, Vst) -> assert_term(Src, Vst), + verify_y_init(Vst), kill_state(Vst); valfun_1(if_end, Vst) -> + verify_y_init(Vst), kill_state(Vst); valfun_1({try_case_end,Src}, Vst) -> + verify_y_init(Vst), assert_term(Src, Vst), kill_state(Vst); %% Instructions that can not cause exceptions @@ -375,6 +379,9 @@ valfun_1({call_ext,Live,Func}=I, Vst) -> case return_type(Func, Vst) of exception -> verify_live(Live, Vst), + %% The stack will be scanned, so Y registers + %% must be initialized. + verify_y_init(Vst), kill_state(Vst); _ -> valfun_2(I, Vst) |