aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2014-06-06 01:47:49 +0200
committerRickard Green <[email protected]>2014-06-06 01:47:49 +0200
commitfd9ded54a9d1d3c1df3c44c0f5eed0be25f85a82 (patch)
tree7238e0341da395b7b1ea45788697de764bdbc009 /erts/emulator/test
parentcb252aecf7da924e2959dadd390f1bbd320b2eb8 (diff)
parent82c048745efcb5d811ec0489858b821ef39ea387 (diff)
downloadotp-fd9ded54a9d1d3c1df3c44c0f5eed0be25f85a82.tar.gz
otp-fd9ded54a9d1d3c1df3c44c0f5eed0be25f85a82.tar.bz2
otp-fd9ded54a9d1d3c1df3c44c0f5eed0be25f85a82.zip
Merge branch 'rickard/binary_to_term_error/OTP-11931' into maint
* rickard/binary_to_term_error/OTP-11931: Replace erlang:binary_to_term() Erlang wrappers Conflicts: erts/preloaded/ebin/erts_internal.beam
Diffstat (limited to 'erts/emulator/test')
-rw-r--r--erts/emulator/test/binary_SUITE.erl22
1 files changed, 21 insertions, 1 deletions
diff --git a/erts/emulator/test/binary_SUITE.erl b/erts/emulator/test/binary_SUITE.erl
index 22c4ed29ad..44e9e4f243 100644
--- a/erts/emulator/test/binary_SUITE.erl
+++ b/erts/emulator/test/binary_SUITE.erl
@@ -1420,6 +1420,11 @@ error_after_yield(Config) when is_list(Config) ->
error_after_yield(badarg, erlang, list_to_bitstring, 1, fun () -> [[list2bitstrlist(mk_list(1000000)), oops]] end, L2BTrap),
error_after_yield(badarg, binary, list_to_bin, 1, fun () -> [[mk_list(1000000), oops]] end, L2BTrap),
+ B2TTrap = {erts_internal, binary_to_term_trap, 1},
+
+ error_after_yield(badarg, erlang, binary_to_term, 1, fun () -> [error_after_yield_bad_ext_term()] end, B2TTrap),
+ error_after_yield(badarg, erlang, binary_to_term, 2, fun () -> [error_after_yield_bad_ext_term(), [safe]] end, B2TTrap),
+
case erlang:system_info(wordsize) of
4 ->
SysLimitSz = 1 bsl 32,
@@ -1462,7 +1467,7 @@ error_after_yield(Type, M, F, AN, AFun, TrapFunc) ->
{trace_delivered, Pid, TD} ->
NoYields = error_after_yield_sched(Pid, TrapFunc, 0),
io:format("No of yields: ~p~n", [NoYields]),
- true = NoYields > 10
+ true = NoYields > 2
end,
ok.
@@ -1485,6 +1490,21 @@ error_after_yield_sched(P, TrapFunc, N) ->
after 0 ->
N
end.
+
+error_after_yield_bad_ext_term() ->
+ TupleSz = 2000000,
+ <<131, % Version magic
+ AtomExt/binary>> = term_to_binary(an_atom_we_use_for_this),
+ BadAtomExt = [100, %% ATOM_EXT
+ 255, 255, % Invalid size of 65535 bytes
+ "oops"],
+
+ %% Produce a large tuple where the last element is invalid
+ list_to_binary([131, %% Version magic
+ 105, %% LARGE_TUPLE_EXT
+ <<TupleSz:32/big>>, %% Tuple size
+ lists:duplicate(TupleSz-1, AtomExt), %% Valid atoms
+ BadAtomExt]). %% Invalid atom at the end
cmp_old_impl(Config) when is_list(Config) ->
%% Compare results from new yielding implementations with