aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2012-03-15 12:13:28 +0100
committerSverker Eriksson <[email protected]>2012-03-15 12:30:34 +0100
commit2fbe8cc9b3f6f443ccccfaa485b05966aacc65d9 (patch)
tree2cc1d689b84b2025b66c9223c615ab014a3753e2 /lib/kernel
parent7484721f847e95380e66456b4a55e08481b570d8 (diff)
downloadotp-2fbe8cc9b3f6f443ccccfaa485b05966aacc65d9.tar.gz
otp-2fbe8cc9b3f6f443ccccfaa485b05966aacc65d9.tar.bz2
otp-2fbe8cc9b3f6f443ccccfaa485b05966aacc65d9.zip
Fix port leaks in zlib
zip,unzip,gzip,gunzip,compress and uncompress did not close the port when given invalid data argument. Fixed by putting close in "try-after". A closed port could in same cases get stuck in limbo due to data in io-queue. Fixed by adding a flush callback.
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/test/zlib_SUITE.erl19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/kernel/test/zlib_SUITE.erl b/lib/kernel/test/zlib_SUITE.erl
index 74bafe8935..e0fd0f5d19 100644
--- a/lib/kernel/test/zlib_SUITE.erl
+++ b/lib/kernel/test/zlib_SUITE.erl
@@ -73,6 +73,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
[{group, api}, {group, examples}, {group, func}, smp,
+ otp_9981,
otp_7359].
groups() ->
@@ -964,6 +965,24 @@ otp_7359_def_inf(Data,{DefSize,InfSize}) ->
?line ok = zlib:close(ZInf),
ok.
+otp_9981(Config) when is_list(Config) ->
+ Ports = lists:sort(erlang:ports()),
+ Invalid = <<"My invalid data">>,
+ catch zlib:compress(invalid),
+ Ports = lists:sort(erlang:ports()),
+ catch zlib:uncompress(Invalid),
+ Ports = lists:sort(erlang:ports()),
+ catch zlib:zip(invalid),
+ Ports = lists:sort(erlang:ports()),
+ catch zlib:unzip(Invalid),
+ Ports = lists:sort(erlang:ports()),
+ catch zlib:gzip(invalid),
+ Ports = lists:sort(erlang:ports()),
+ catch zlib:gunzip(Invalid),
+ Ports = lists:sort(erlang:ports()),
+ ok.
+
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Helps with testing directly %%%%%%%%%%%%%