aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2017-09-29 15:25:02 +0200
committerJohn Högberg <[email protected]>2017-09-29 17:50:21 +0200
commit2257a0a2debf0a390e887e09c85bf14ba186f278 (patch)
treeb3b3411eb262e910b0a9501a719f436e16daf1e7 /lib/kernel/test
parentbf9f00f16b9825c5df235c2df4b325f97fed199a (diff)
downloadotp-2257a0a2debf0a390e887e09c85bf14ba186f278.tar.gz
otp-2257a0a2debf0a390e887e09c85bf14ba186f278.tar.bz2
otp-2257a0a2debf0a390e887e09c85bf14ba186f278.zip
Fix gunzip/1 of concatenated gzip files
Quoting RFC 1952: "A gzip file consists of a series of "members" (compressed data sets). [...] The members simply appear one after another in the file, with no additional information before, between, or after them."
Diffstat (limited to 'lib/kernel/test')
-rw-r--r--lib/kernel/test/zlib_SUITE.erl9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/kernel/test/zlib_SUITE.erl b/lib/kernel/test/zlib_SUITE.erl
index b7e053b137..d17eded811 100644
--- a/lib/kernel/test/zlib_SUITE.erl
+++ b/lib/kernel/test/zlib_SUITE.erl
@@ -636,6 +636,7 @@ api_g_un_zip(Config) when is_list(Config) ->
?m(?EXIT(badarg),zlib:gzip(not_a_binary)),
Bin = <<1,11,1,23,45>>,
Comp = zlib:gzip(Bin),
+
?m(Comp, zlib:gzip(binary_to_list(Bin))),
?m(?EXIT(badarg), zlib:gunzip(not_a_binary)),
?m(?EXIT(data_error), zlib:gunzip(<<171,171,171,171,171>>)),
@@ -643,6 +644,14 @@ api_g_un_zip(Config) when is_list(Config) ->
?m(Bin, zlib:gunzip(Comp)),
?m(Bin, zlib:gunzip(binary_to_list(Comp))),
+ %% RFC 1952:
+ %%
+ %% "A gzip file consists of a series of "members" (compressed data
+ %% sets). [...] The members simply appear one after another in the file,
+ %% with no additional information before, between, or after them."
+ Concatenated = <<Bin/binary, Bin/binary>>,
+ ?m(Concatenated, zlib:gunzip([Comp, Comp])),
+
%% Bad CRC; bad length.
BadCrc = bad_crc_data(),
?m(?EXIT(data_error),(catch zlib:gunzip(BadCrc))),