aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-02-06 10:08:15 +0100
committerBjörn Gustavsson <[email protected]>2014-02-06 10:08:15 +0100
commit503b0769e647f06b15b8d5e5fd09f3b2ab10ebfa (patch)
tree639a5d81f85ffc83f5023f4b0d4ae04c2882e178 /lib/compiler/test
parent3efa33db1e59b400babf672b07763c4a2467798a (diff)
parent5f4b495e68de1d1762cad0a96d01b5195d3b458e (diff)
downloadotp-503b0769e647f06b15b8d5e5fd09f3b2ab10ebfa.tar.gz
otp-503b0769e647f06b15b8d5e5fd09f3b2ab10ebfa.tar.bz2
otp-503b0769e647f06b15b8d5e5fd09f3b2ab10ebfa.zip
Merge branch 'bjorn/compiler/applying-binary-crash/OTP-11672'
* bjorn/compiler/applying-binary-crash/OTP-11672: beam_bsm: Eliminate emulator crash when a binary is called beam_validator: Validate the "fun" argument for a call_fun/1 instruction
Diffstat (limited to 'lib/compiler/test')
-rw-r--r--lib/compiler/test/bs_match_SUITE.erl15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/compiler/test/bs_match_SUITE.erl b/lib/compiler/test/bs_match_SUITE.erl
index 9f15845d33..149b9bbb8f 100644
--- a/lib/compiler/test/bs_match_SUITE.erl
+++ b/lib/compiler/test/bs_match_SUITE.erl
@@ -34,7 +34,7 @@
otp_7188/1,otp_7233/1,otp_7240/1,otp_7498/1,
match_string/1,zero_width/1,bad_size/1,haystack/1,
cover_beam_bool/1,matched_out_size/1,follow_fail_branch/1,
- no_partition/1]).
+ no_partition/1,calling_a_binary/1]).
-export([coverage_id/1,coverage_external_ignore/2]).
@@ -59,7 +59,7 @@ groups() ->
matching_and_andalso,otp_7188,otp_7233,otp_7240,
otp_7498,match_string,zero_width,bad_size,haystack,
cover_beam_bool,matched_out_size,follow_fail_branch,
- no_partition]}].
+ no_partition,calling_a_binary]}].
init_per_suite(Config) ->
@@ -1178,6 +1178,17 @@ no_partition_2([], a5) ->
no_partition_2(42.0, a6) ->
six.
+calling_a_binary(Config) when is_list(Config) ->
+ [] = call_binary(<<>>, []),
+ {'EXIT',{badarg,_}} = (catch call_binary(<<1>>, [])),
+ {'EXIT',{badarg,_}} = (catch call_binary(<<1,2,3>>, [])),
+ ok.
+
+call_binary(<<>>, Acc) ->
+ Acc;
+call_binary(<<H,T/bits>>, Acc) ->
+ T(<<Acc/binary,H>>).
+
check(F, R) ->
R = F().