aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/bs_construct_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-03-19 14:40:32 +0100
committerBjörn Gustavsson <[email protected]>2018-03-19 14:47:48 +0100
commit4332bcdc9f6dd1b4c390a50df07b7e8ebf536f88 (patch)
treef982e652a9a60907529937ef66c26e6619853cfd /lib/compiler/test/bs_construct_SUITE.erl
parent6751506b67e3ba6f4ce9eacd040ea269fca643fd (diff)
downloadotp-4332bcdc9f6dd1b4c390a50df07b7e8ebf536f88.tar.gz
otp-4332bcdc9f6dd1b4c390a50df07b7e8ebf536f88.tar.bz2
otp-4332bcdc9f6dd1b4c390a50df07b7e8ebf536f88.zip
core_parse: Fix handling of negative sizes in binaries
A literal negative size in binary construction would cause a crash.
Diffstat (limited to 'lib/compiler/test/bs_construct_SUITE.erl')
-rw-r--r--lib/compiler/test/bs_construct_SUITE.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/compiler/test/bs_construct_SUITE.erl b/lib/compiler/test/bs_construct_SUITE.erl
index da99aba346..7c5ad97f7e 100644
--- a/lib/compiler/test/bs_construct_SUITE.erl
+++ b/lib/compiler/test/bs_construct_SUITE.erl
@@ -303,7 +303,14 @@ fail(Config) when is_list(Config) ->
{'EXIT',{badarg,_}} = (catch <<42.0/integer>>),
{'EXIT',{badarg,_}} = (catch <<42/binary>>),
{'EXIT',{badarg,_}} = (catch <<an_atom/integer>>),
-
+
+ %% Bad literal sizes
+ Bin = i(<<>>),
+ {'EXIT',{badarg,_}} = (catch <<0:(-1)>>),
+ {'EXIT',{badarg,_}} = (catch <<Bin/binary,0:(-1)>>),
+ {'EXIT',{badarg,_}} = (catch <<0:(-(1 bsl 100))>>),
+ {'EXIT',{badarg,_}} = (catch <<Bin/binary,0:(-(1 bsl 100))>>),
+
ok.
float_bin(Config) when is_list(Config) ->