Kitxuuu commited on
Commit
34f4058
·
verified ·
1 Parent(s): 9879f8b

Add files using upload-large-folder tool

Browse files
Files changed (20) hide show
  1. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/site/xdoc/conventions.xml +71 -0
  2. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/site/xdoc/index.xml +122 -0
  3. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/site/xdoc/issue-tracking.xml +104 -0
  4. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/site/xdoc/mail-lists.xml +215 -0
  5. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/site/xdoc/pack200.xml +91 -0
  6. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/site/xdoc/zip.xml +645 -0
  7. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/COMPRESS-379.jar +0 -0
  8. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/COMPRESS-382 +0 -0
  9. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/COMPRESS-386 +1 -0
  10. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/bla-multi.7z.001 +0 -0
  11. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/bla.pack +0 -0
  12. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/bla.unix.arj +0 -0
  13. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/longfile_bsd.ar +5 -0
  14. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/longfile_gnu.ar +8 -0
  15. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/test with spaces.txt +11 -0
  16. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/test1.xml +4 -0
  17. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/test3.xml +10 -0
  18. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/test4.xml +6 -0
  19. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/testAIFF.aif +0 -0
  20. local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/zipbomb.xlsx +0 -0
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/site/xdoc/conventions.xml ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ Licensed to the Apache Software Foundation (ASF) under one or more
4
+ contributor license agreements. See the NOTICE file distributed with
5
+ this work for additional information regarding copyright ownership.
6
+ The ASF licenses this file to You under the Apache License, Version 2.0
7
+ (the "License"); you may not use this file except in compliance with
8
+ the License. You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ -->
18
+ <document xmlns="http://maven.apache.org/XDOC/2.0"
19
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20
+ xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 https://maven.apache.org/xsd/xdoc-2.0.xsd">
21
+ <properties>
22
+ <title>Conventions</title>
23
+ </properties>
24
+
25
+ <body>
26
+ <section name="Code Style">
27
+ <p>
28
+ The developers of this component decided to follow the recommended standards
29
+ but not to include Checkstyle (or similar tools) into Commons Compress.
30
+ </p>
31
+ </section>
32
+ <section name="Multithreading">
33
+ <p>
34
+ Commons Compress does not aim to be threadsafe at the moment. But the developers
35
+ agreed to document multithreading behavior in the javadocs.
36
+ </p>
37
+ <p>
38
+ We use some of the annotations from
39
+ <a href="http://jcip.net/annotations/doc/net/jcip/annotations/package-summary.html">JCIP</a>
40
+ as Javadoc tags. The used tags are:
41
+ </p>
42
+ <ul>
43
+ <li>@GuardedBy (field or method)</li>
44
+ <li>@Immutable (class)</li>
45
+ <li>@NotThreadSafe (class)</li>
46
+ <li>@ThreadSafe (class)</li>
47
+ </ul>
48
+ <p>
49
+ For example:
50
+ <source>
51
+ /**
52
+ * Utility class that represents a four byte integer with conversion
53
+ * rules for the big endian byte order of ZIP files.
54
+ *
55
+ * @Immutable
56
+ */
57
+ public final class ZipLong implements Cloneable {
58
+ </source>
59
+
60
+ and:
61
+
62
+ <source>
63
+ private final char [] highChars;
64
+ //@GuardedBy("this")
65
+ private Simple8BitZipEncoding encoding;
66
+ </source>
67
+ </p>
68
+ </section>
69
+
70
+ </body>
71
+ </document>
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/site/xdoc/index.xml ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+
4
+ Licensed to the Apache Software Foundation (ASF) under one or more
5
+ contributor license agreements. See the NOTICE file distributed with
6
+ this work for additional information regarding copyright ownership.
7
+ The ASF licenses this file to You under the Apache License, Version 2.0
8
+ (the "License"); you may not use this file except in compliance with
9
+ the License. You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ -->
20
+ <document xmlns="http://maven.apache.org/XDOC/2.0"
21
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22
+ xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 https://maven.apache.org/xsd/xdoc-2.0.xsd">
23
+ <properties>
24
+ <title>Overview</title>
25
+ <author email="dev@commons.apache.org">Apache Commons Team</author>
26
+ </properties>
27
+ <body>
28
+ <section name="Apache Commons Compress&#x2122;">
29
+ <p>
30
+ The Apache Commons Compress library defines an API for
31
+ working with ar, cpio, Unix dump, tar, zip, gzip, XZ,
32
+ Pack200, bzip2, 7z, arj, LZMA, snappy, DEFLATE, lz4,
33
+ Brotli, Zstandard, DEFLATE64 and Z files.
34
+ </p>
35
+ <p>
36
+ The code in this component has many origins:
37
+ </p>
38
+ <ul>
39
+ <li>The bzip2, tar and zip support came from Avalon's
40
+ Excalibur, but originally from Ant, as far as life in
41
+ Apache goes. The tar package is originally Tim Endres'
42
+ public domain package. The bzip2 package is based on
43
+ the work done by Keiron Liddle as well as Julian Seward's
44
+ <a href="http://www.bzip.org/index.html">libbzip2</a>.
45
+ It has migrated
46
+ via:<br/> Ant -&gt; Avalon-Excalibur -&gt; Commons-IO
47
+ -&gt; Commons-Compress.</li>
48
+ <li>The cpio package has been contributed by Michael Kuss
49
+ and
50
+ the <a href="http://jrpm.sourceforge.net/">jRPM</a>
51
+ project.</li>
52
+ <li>The pack200 code has originally been part of the now
53
+ retired <a href="https://harmony.apache.org/">Apache
54
+ Harmony&#x2122;</a> project.</li>
55
+ </ul>
56
+
57
+ </section>
58
+
59
+ <section name="Status">
60
+ <p>The current release requires Java 8 or above.</p>
61
+
62
+ <p>For a list of changes see the <a href="changes.html">Changes Report</a>.</p>
63
+
64
+ </section>
65
+
66
+ <section name="Documentation">
67
+ <p>The compress component is split into <em>compressors</em> and
68
+ <em>archivers</em>. While <em>compressors</em>
69
+ (un)compress streams that usually store a single
70
+ entry, <em>archivers</em> deal with archives that contain
71
+ structured content represented
72
+ by <code>ArchiveEntry</code> instances which in turn
73
+ usually correspond to single files or directories.</p>
74
+
75
+ <p>Currently the bzip2, Pack200, XZ, gzip, LZMA, brotli,
76
+ Zstandard and Z formats are
77
+ supported as compressors where gzip support is mostly provided by
78
+ the <code>java.util.zip</code> package of the Java
79
+ class library. XZ and LZMA support is provided by the public
80
+ domain <a href="https://tukaani.org/xz/java.html">XZ for
81
+ Java</a> library. Brotli support is provided by the MIT
82
+ licensed <a href="https://github.com/google/brotli">Google
83
+ Brotli decoder</a>. Zstandard support is provided by the BSD
84
+ licensed <a href="https://github.com/luben/zstd-jni">Zstd-jni</a>.
85
+ As of Commons Compress 1.21 support for the DEFLATE64, Z and Brotli
86
+ formats is read-only.</p>
87
+
88
+ <p>The ar, arj, cpio, dump, tar, 7z and zip formats are supported as
89
+ archivers where the <a href="zip.html">zip</a>
90
+ implementation provides capabilities that go beyond the
91
+ features found in java.util.zip. As of Commons Compress
92
+ 1.21 support for the dump and arj formats is
93
+ read-only - 7z can read most compressed and encrypted
94
+ archives but only write unencrypted ones. LZMA(2) support
95
+ in 7z requires <a href="https://tukaani.org/xz/java.html">XZ for
96
+ Java</a> as well.</p>
97
+
98
+ <p>The compress component provides abstract base classes for
99
+ compressors and archivers together with factories that can
100
+ be used to choose implementations by algorithm name. In
101
+ the case of input streams the factories can also be used
102
+ to guess the format and provide the matching
103
+ implementation.</p>
104
+
105
+ <ul>
106
+ <li>The <a href="examples.html">user guide</a> contains
107
+ more detailed information and some examples.</li>
108
+ <li>The <a href="limitations.html">known limitations and
109
+ problems</a> page lists the currently known problems
110
+ grouped by the format they apply to.</li>
111
+ <li>The <a href="apidocs/index.html">Javadoc</a> of the latest GIT</li>
112
+ <li>The <a href="https://gitbox.apache.org/repos/asf?p=commons-compress.git">GIT
113
+ repository</a> can be browsed.</li>
114
+ </ul>
115
+ </section>
116
+ <section name="Releases">
117
+ <p>
118
+ <a href="https://commons.apache.org/compress/download_compress.cgi">Download now!</a>
119
+ </p>
120
+ </section>
121
+ </body>
122
+ </document>
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/site/xdoc/issue-tracking.xml ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ Licensed to the Apache Software Foundation (ASF) under one or more
4
+ contributor license agreements. See the NOTICE file distributed with
5
+ this work for additional information regarding copyright ownership.
6
+ The ASF licenses this file to You under the Apache License, Version 2.0
7
+ (the "License"); you may not use this file except in compliance with
8
+ the License. You may obtain a copy of the License at
9
+
10
+ https://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ -->
18
+ <!--
19
+ +======================================================================+
20
+ |**** ****|
21
+ |**** THIS FILE IS GENERATED BY THE COMMONS BUILD PLUGIN ****|
22
+ |**** DO NOT EDIT DIRECTLY ****|
23
+ |**** ****|
24
+ +======================================================================+
25
+ | TEMPLATE FILE: issue-tracking-template.xml |
26
+ | commons-build-plugin/trunk/src/main/resources/commons-xdoc-templates |
27
+ +======================================================================+
28
+ | |
29
+ | 1) Re-generate using: mvn commons-build:jira-page |
30
+ | |
31
+ | 2) Set the following properties in the component's pom: |
32
+ | - commons.jira.id (required, alphabetic, upper case) |
33
+ | - commons.jira.pid (required, numeric) |
34
+ | |
35
+ | 3) Example Properties |
36
+ | |
37
+ | <properties> |
38
+ | <commons.jira.id>MATH</commons.jira.id> |
39
+ | <commons.jira.pid>12310485</commons.jira.pid> |
40
+ | </properties> |
41
+ | |
42
+ +======================================================================+
43
+ -->
44
+ <document xmlns="http://maven.apache.org/XDOC/2.0"
45
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
46
+ xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 https://maven.apache.org/xsd/xdoc-2.0.xsd">
47
+ <properties>
48
+ <title>Apache Commons Compress Issue tracking</title>
49
+ <author email="dev@commons.apache.org">Apache Commons Team</author>
50
+ </properties>
51
+ <body>
52
+
53
+ <section name="Apache Commons Compress Issue tracking">
54
+ <p>
55
+ Apache Commons Compress uses <a href="https://issues.apache.org/jira/">ASF JIRA</a> for tracking issues.
56
+ See the <a href="https://issues.apache.org/jira/browse/COMPRESS">Apache Commons Compress JIRA project page</a>.
57
+ </p>
58
+
59
+ <p>
60
+ To use JIRA you may need to <a href="https://issues.apache.org/jira/secure/Signup!default.jspa">create an account</a>
61
+ (if you have previously created/updated Commons issues using Bugzilla an account will have been automatically
62
+ created and you can use the <a href="https://issues.apache.org/jira/secure/ForgotPassword!default.jspa">Forgot Password</a>
63
+ page to get a new password).
64
+ </p>
65
+
66
+ <p>
67
+ If you would like to report a bug, or raise an enhancement request with
68
+ Apache Commons Compress please do the following:
69
+ </p>
70
+ <ol>
71
+ <li><a href="https://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&amp;pid=12310904&amp;sorter/field=issuekey&amp;sorter/order=DESC&amp;status=1&amp;status=3&amp;status=4">Search existing open bugs</a>.
72
+ If you find your issue listed then please add a comment with your details.</li>
73
+ <li><a href="mail-lists.html">Search the mailing list archive(s)</a>.
74
+ You may find your issue or idea has already been discussed.</li>
75
+ <li>Decide if your issue is a bug or an enhancement.</li>
76
+ <li>Submit either a <a href="https://issues.apache.org/jira/secure/CreateIssueDetails!init.jspa?pid=12310904&amp;issuetype=1&amp;priority=4&amp;assignee=-1">bug report</a>
77
+ or <a href="https://issues.apache.org/jira/secure/CreateIssueDetails!init.jspa?pid=12310904&amp;issuetype=4&amp;priority=4&amp;assignee=-1">enhancement request</a>.</li>
78
+ </ol>
79
+
80
+ <p>
81
+ Please also remember these points:
82
+ </p>
83
+ <ul>
84
+ <li>the more information you provide, the better we can help you</li>
85
+ <li>test cases are vital, particularly for any proposed enhancements</li>
86
+ <li>the developers of Apache Commons Compress are all unpaid volunteers</li>
87
+ </ul>
88
+
89
+ <p>
90
+ For more information on creating patches see the
91
+ <a href="https://www.apache.org/dev/contributors.html">Apache Contributors Guide</a>.
92
+ </p>
93
+
94
+ <p>
95
+ You may also find these links useful:
96
+ </p>
97
+ <ul>
98
+ <li><a href="https://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&amp;pid=12310904&amp;sorter/field=issuekey&amp;sorter/order=DESC&amp;status=1&amp;status=3&amp;status=4">All Open Apache Commons Compress bugs</a></li>
99
+ <li><a href="https://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&amp;pid=12310904&amp;sorter/field=issuekey&amp;sorter/order=DESC&amp;status=5&amp;status=6">All Resolved Apache Commons Compress bugs</a></li>
100
+ <li><a href="https://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&amp;pid=12310904&amp;sorter/field=issuekey&amp;sorter/order=DESC">All Apache Commons Compress bugs</a></li>
101
+ </ul>
102
+ </section>
103
+ </body>
104
+ </document>
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/site/xdoc/mail-lists.xml ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ Licensed to the Apache Software Foundation (ASF) under one or more
4
+ contributor license agreements. See the NOTICE file distributed with
5
+ this work for additional information regarding copyright ownership.
6
+ The ASF licenses this file to You under the Apache License, Version 2.0
7
+ (the "License"); you may not use this file except in compliance with
8
+ the License. You may obtain a copy of the License at
9
+
10
+ https://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ -->
18
+ <!--
19
+ +======================================================================+
20
+ |**** ****|
21
+ |**** THIS FILE IS GENERATED BY THE COMMONS BUILD PLUGIN ****|
22
+ |**** DO NOT EDIT DIRECTLY ****|
23
+ |**** ****|
24
+ +======================================================================+
25
+ | TEMPLATE FILE: mail-lists-template.xml |
26
+ | commons-build-plugin/trunk/src/main/resources/commons-xdoc-templates |
27
+ +======================================================================+
28
+ | |
29
+ | 1) Re-generate using: mvn commons-build:mail-page |
30
+ | |
31
+ | 2) Set the following properties in the component's pom: |
32
+ | - commons.componentid (required, alphabetic, lower case) |
33
+ | |
34
+ | 3) Example Properties |
35
+ | |
36
+ | <properties> |
37
+ | <commons.componentid>math</commons.componentid> |
38
+ | </properties> |
39
+ | |
40
+ +======================================================================+
41
+ -->
42
+ <document xmlns="http://maven.apache.org/XDOC/2.0"
43
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
+ xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 https://maven.apache.org/xsd/xdoc-2.0.xsd">
45
+ <properties>
46
+ <title>Apache Commons Compress Mailing Lists</title>
47
+ <author email="dev@commons.apache.org">Apache Commons Team</author>
48
+ </properties>
49
+ <body>
50
+
51
+ <section name="Overview">
52
+ <p>
53
+ <a href="index.html">Apache Commons Compress</a> shares mailing lists with all the other
54
+ <a href="https://commons.apache.org/components.html">Commons Components</a>.
55
+ To make it easier for people to only read messages related to components they are interested in,
56
+ the convention in Commons is to prefix the subject line of messages with the component's name,
57
+ for example:
58
+ </p>
59
+ <ul>
60
+ <li>[compress] Problem with the ...</li>
61
+ </ul>
62
+ <p>
63
+ Questions related to the usage of Apache Commons Compress should be posted to the
64
+ <a href="https://lists.apache.org/list.html?user@commons.apache.org">User List</a>.
65
+ <br />
66
+ The <a href="https://lists.apache.org/list.html?dev@commons.apache.org">Developer List</a>
67
+ is for questions and discussion related to the development of Apache Commons Compress.
68
+ <br />
69
+ Please do not cross-post; developers are also subscribed to the user list.
70
+ <br />
71
+ You must be subscribed to post to the mailing lists. Follow the Subscribe links below
72
+ to subscribe.
73
+ </p>
74
+ <p>
75
+ <strong>Note:</strong> please don't send patches or attachments to any of the mailing lists;
76
+ most of the lists are set up to drop attachments.
77
+ Patches are best handled via the <a href="issue-tracking.html">Issue Tracking</a> system.
78
+ If you have a GitHub account, most components also accept PRs (pull requests).
79
+ Otherwise, please upload the file to a public server and include the URL in the mail.
80
+ </p>
81
+ </section>
82
+
83
+ <section name="Apache Commons Compress Mailing Lists">
84
+ <p>
85
+ <strong>Please prefix the subject line of any messages for <a href="index.html">Apache Commons Compress</a>
86
+ with <i>[compress]</i></strong> - <i>thanks!</i>
87
+ <br />
88
+ <br />
89
+ </p>
90
+
91
+ <table>
92
+ <tr>
93
+ <th>Name</th>
94
+ <th>Subscribe</th>
95
+ <th>Unsubscribe</th>
96
+ <th>Post</th>
97
+ <th>Archive</th>
98
+ <th>Other Archives</th>
99
+ </tr>
100
+
101
+
102
+ <tr>
103
+ <td>
104
+ <strong>Commons User List</strong>
105
+ <br /><br />
106
+ Questions on using Apache Commons Compress.
107
+ <br /><br />
108
+ </td>
109
+ <td><a href="mailto:user-subscribe@commons.apache.org">Subscribe</a></td>
110
+ <td><a href="mailto:user-unsubscribe@commons.apache.org">Unsubscribe</a></td>
111
+ <td><a href="mailto:user@commons.apache.org?subject=[compress]">Post</a></td>
112
+ <td>
113
+ <a href="https://lists.apache.org/list.html?user@commons.apache.org">lists.apache.org</a>
114
+ </td>
115
+ <td>
116
+ <a href="https://www.mail-archive.com/user@commons.apache.org/">www.mail-archive.com</a>
117
+ </td>
118
+ </tr>
119
+
120
+
121
+ <tr>
122
+ <td>
123
+ <strong>Commons Developer List</strong>
124
+ <br /><br />
125
+ Discussion of development of Apache Commons Compress.
126
+ <br /><br />
127
+ </td>
128
+ <td><a href="mailto:dev-subscribe@commons.apache.org">Subscribe</a></td>
129
+ <td><a href="mailto:dev-unsubscribe@commons.apache.org">Unsubscribe</a></td>
130
+ <td><a href="mailto:dev@commons.apache.org?subject=[compress]">Post</a></td>
131
+ <td>
132
+ <a href="https://lists.apache.org/list.html?dev@commons.apache.org">lists.apache.org</a>
133
+ </td>
134
+ <td>
135
+ <a href="https://www.mail-archive.com/dev@commons.apache.org/">www.mail-archive.com</a>
136
+ </td>
137
+ </tr>
138
+
139
+
140
+ <tr>
141
+ <td>
142
+ <strong>Commons Issues List</strong>
143
+ <br /><br />
144
+ Only for e-mails automatically generated by the <a href="issue-tracking.html">issue tracking</a> system.
145
+ <br /><br />
146
+ </td>
147
+ <td><a href="mailto:issues-subscribe@commons.apache.org">Subscribe</a></td>
148
+ <td><a href="mailto:issues-unsubscribe@commons.apache.org">Unsubscribe</a></td>
149
+ <td><i>read only</i></td>
150
+ <td>
151
+ <a href="https://lists.apache.org/list.html?issues@commons.apache.org">lists.apache.org</a>
152
+ </td>
153
+ <td>
154
+ <a href="https://www.mail-archive.com/issues@commons.apache.org/">www.mail-archive.com</a>
155
+ </td>
156
+ </tr>
157
+
158
+
159
+ <tr>
160
+ <td>
161
+ <strong>Commons Commits List</strong>
162
+ <br /><br />
163
+ Only for e-mails automatically generated by the <a href="scm.html">source control</a> system.
164
+ <br /><br />
165
+ </td>
166
+ <td><a href="mailto:commits-subscribe@commons.apache.org">Subscribe</a></td>
167
+ <td><a href="mailto:commits-unsubscribe@commons.apache.org">Unsubscribe</a></td>
168
+ <td><i>read only</i></td>
169
+ <td>
170
+ <a href="https://lists.apache.org/list.html?commits@commons.apache.org">lists.apache.org</a>
171
+ </td>
172
+ <td>
173
+ <a href="https://www.mail-archive.com/commits@commons.apache.org/">www.mail-archive.com</a>
174
+ </td>
175
+ </tr>
176
+
177
+ </table>
178
+
179
+ </section>
180
+ <section name="Apache Mailing Lists">
181
+ <p>
182
+ Other mailing lists which you may find useful include:
183
+ </p>
184
+
185
+ <table>
186
+ <tr>
187
+ <th>Name</th>
188
+ <th>Subscribe</th>
189
+ <th>Unsubscribe</th>
190
+ <th>Post</th>
191
+ <th>Archive</th>
192
+ <th>Other Archives</th>
193
+ </tr>
194
+ <tr>
195
+ <td>
196
+ <strong>Apache Announce List</strong>
197
+ <br /><br />
198
+ General announcements of Apache project releases.
199
+ <br /><br />
200
+ </td>
201
+ <td><a class="externalLink" href="mailto:announce-subscribe@apache.org">Subscribe</a></td>
202
+ <td><a class="externalLink" href="mailto:announce-unsubscribe@apache.org">Unsubscribe</a></td>
203
+ <td><i>read only</i></td>
204
+ <td>
205
+ <a class="externalLink" href="https://lists.apache.org/list.html?announce@apache.org">lists.apache.org</a>
206
+ </td>
207
+ <td>
208
+ <a class="externalLink" href="https://www.mail-archive.com/announce@apache.org/">www.mail-archive.com</a>
209
+ </td>
210
+ </tr>
211
+ </table>
212
+
213
+ </section>
214
+ </body>
215
+ </document>
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/site/xdoc/pack200.xml ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+
4
+ Licensed to the Apache Software Foundation (ASF) under one or more
5
+ contributor license agreements. See the NOTICE file distributed with
6
+ this work for additional information regarding copyright ownership.
7
+ The ASF licenses this file to You under the Apache License, Version 2.0
8
+ (the "License"); you may not use this file except in compliance with
9
+ the License. You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ -->
20
+ <document xmlns="http://maven.apache.org/XDOC/2.0"
21
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22
+ xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 https://maven.apache.org/xsd/xdoc-2.0.xsd">
23
+ <properties>
24
+ <title>Commons Compress Pack200 Package</title>
25
+ <author email="dev@commons.apache.org">Apache Commons Team</author>
26
+ </properties>
27
+ <body>
28
+ <section name="The Pack200 package">
29
+
30
+ <p>The Pack200 algorithm is not a general purpose compression
31
+ algorithm but one specialized for compressing JAR archives. JAR
32
+ archives compressed with Pack200 will in general be different
33
+ from the original archive when decompressed again. More
34
+ information can be found in the Javadocs of the <a
35
+ href="https://docs.oracle.com/javase/7/docs/api/java/util/jar/Pack200.Packer.html">Pack200.Packer
36
+ class</a>.</p>
37
+
38
+ <p>While the <code>pack200</code> command line utility of the
39
+ JDK creates GZip compressed archives (<code>.pack.gz</code>) by
40
+ default, the streams provided by the Pack200 package only
41
+ perform the actual Pack200 operation. Wrap them in an
42
+ additional <code>GzipCompressor(In|Out)putStream</code> in order to deal
43
+ with deflated streams.</p>
44
+
45
+ <subsection name="Pack200Strategy">
46
+
47
+ <p>The Pack200-API provided by the java class library is not
48
+ streaming friendly as it wants to consume its input completely
49
+ in a single operation. Because of this
50
+ <code>Pack200CompressorInputStream</code>'s constructor will immediately
51
+ unpack the stream, cache the results and provide an input
52
+ stream to the cache.</p>
53
+
54
+ <p><code>Pack200CompressorOutputStream</code> will cache all data that
55
+ is written to it and then pack it once the <code>finish</code>
56
+ or <code>close</code> method is called.</p>
57
+
58
+ <p>Two different caching modes are available - "in memory",
59
+ which is the default, and "temporary file". By default data
60
+ is cached in memory but you should switch to the temporary
61
+ file option if your archives are really big.</p>
62
+
63
+ <p>Given there always is an intermediate result
64
+ the <code>getBytesRead</code> and <code>getCount</code>
65
+ methods of <code>Pack200CompressorInputStream</code> are
66
+ meaningless (read from the real stream or from the
67
+ intermediate result?) and always return 0.</p>
68
+
69
+ </subsection>
70
+
71
+ <subsection name="Normalization">
72
+
73
+ <p>As a pack/unpack cycle may create a JAR archive that is
74
+ different from the original, digital signatures created for
75
+ the initial JAR will be broken by the process. There is a way
76
+ to "normalize" JAR archives prior to packing them that ensures
77
+ signatures applied to the "normalized" JAR will still be valid
78
+ aftre a pack/unpack cycle - see <a
79
+ href="https://download.oracle.com/javase/7/docs/api/java/util/jar/Pack200.Packer.html">Pack200.Packer</a>'s
80
+ javadocs.</p>
81
+
82
+ <p>The <code>Pack200Utils</code> class in the
83
+ <code>pack200</code> package provides several overloads of a
84
+ <code>normalize</code> method that can be used to prepare a
85
+ JAR archive in place or to a separate file.</p>
86
+
87
+ </subsection>
88
+
89
+ </section>
90
+ </body>
91
+ </document>
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/site/xdoc/zip.xml ADDED
@@ -0,0 +1,645 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+
4
+ Licensed to the Apache Software Foundation (ASF) under one or more
5
+ contributor license agreements. See the NOTICE file distributed with
6
+ this work for additional information regarding copyright ownership.
7
+ The ASF licenses this file to You under the Apache License, Version 2.0
8
+ (the "License"); you may not use this file except in compliance with
9
+ the License. You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ -->
20
+ <document xmlns="http://maven.apache.org/XDOC/2.0"
21
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22
+ xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 https://maven.apache.org/xsd/xdoc-2.0.xsd">
23
+ <properties>
24
+ <title>Commons Compress ZIP package</title>
25
+ <author email="dev@commons.apache.org">Apache Commons Team</author>
26
+ </properties>
27
+ <body>
28
+ <section name="The ZIP package">
29
+
30
+ <p>The ZIP package provides features not found
31
+ in <code>java.util.zip</code>:</p>
32
+
33
+ <ul>
34
+ <li>Support for encodings other than UTF-8 for filenames and
35
+ comments. Starting with Java7 this is supported
36
+ by <code>java.util.zip</code> as well.</li>
37
+ <li>Access to internal and external attributes (which are used
38
+ to store Unix permission by some zip implementations).</li>
39
+ <li>Structured support for extra fields.</li>
40
+ </ul>
41
+
42
+ <p>In addition to the information stored
43
+ in <code>ArchiveEntry</code> a <code>ZipArchiveEntry</code>
44
+ stores internal and external attributes as well as extra
45
+ fields which may contain information like Unix permissions,
46
+ information about the platform they've been created on, their
47
+ last modification time and an optional comment.</p>
48
+
49
+ <subsection name="ZipArchiveInputStream vs ZipFile">
50
+
51
+ <p>ZIP archives store a archive entries in sequence and
52
+ contain a registry of all entries at the very end of the
53
+ archive. It is acceptable for an archive to contain several
54
+ entries of the same name and have the registry (called the
55
+ central directory) decide which entry is actually to be used
56
+ (if any).</p>
57
+
58
+ <p>In addition the ZIP format stores certain information only
59
+ inside the central directory but not together with the entry
60
+ itself, this is:</p>
61
+
62
+ <ul>
63
+ <li>internal and external attributes</li>
64
+ <li>different or additional extra fields</li>
65
+ </ul>
66
+
67
+ <p>This means the ZIP format cannot really be parsed
68
+ correctly while reading a non-seekable stream, which is what
69
+ <code>ZipArchiveInputStream</code> is forced to do. As a
70
+ result <code>ZipArchiveInputStream</code></p>
71
+ <ul>
72
+ <li>may return entries that are not part of the central
73
+ directory at all and shouldn't be considered part of the
74
+ archive.</li>
75
+ <li>may return several entries with the same name.</li>
76
+ <li>will not return internal or external attributes.</li>
77
+ <li>may return incomplete extra field data.</li>
78
+ <li>may return unknown sizes and CRC values for entries
79
+ until the next entry has been reached if the archive uses
80
+ the data descriptor feature (see below).</li>
81
+ <li>can not skip over bytes that occur before the real zip
82
+ stream. This means self-extracting zips as they are created
83
+ by some tools can not be read using
84
+ <code>ZipArchiveInputStream</code> at all. This also applies
85
+ to Chrome extension archives, for example.</li>
86
+ </ul>
87
+
88
+ <p><code>ZipArchiveInputStream</code> shares these limitations
89
+ with <code>java.util.zip.ZipInputStream</code>.</p>
90
+
91
+ <p><code>ZipFile</code> is able to read the central directory
92
+ first and provide correct and complete information on any
93
+ ZIP archive.</p>
94
+
95
+ <p>ZIP archives know a feature called the data descriptor
96
+ which is a way to store an entry's length after the entry's
97
+ data. This can only work reliably if the size information
98
+ can be taken from the central directory or the data itself
99
+ can signal it is complete, which is true for data that is
100
+ compressed using the DEFLATED compression algorithm.</p>
101
+
102
+ <p><code>ZipFile</code> has access to the central directory
103
+ and can extract entries using the data descriptor reliably.
104
+ The same is true for <code>ZipArchiveInputStream</code> as
105
+ long as the entry is DEFLATED. For STORED
106
+ entries <code>ZipArchiveInputStream</code> can try to read
107
+ ahead until it finds the next entry, but this approach is
108
+ not safe and has to be enabled by a constructor argument
109
+ explicitly. For example it will completely fail if the
110
+ stored entry is a ZIP archive itself. Starting with Compress 1.19
111
+ <code>ZipArchiveInputStream</code> will perform a few sanity
112
+ checks for STORED entries with data descriptors and throw an
113
+ exception if they fail.</p>
114
+
115
+ <p>If possible, you should <strong>always</strong> prefer <code>ZipFile</code>
116
+ over <code>ZipArchiveInputStream</code>.</p>
117
+
118
+ <p><code>ZipFile</code> requires a
119
+ <code>SeekableByteChannel</code> that will be obtained
120
+ transparently when reading from a file. The class
121
+ <code>org.apache.commons.compress.utils.SeekableInMemoryByteChannel</code>
122
+ allows you to read from an in-memory archive.</p>
123
+
124
+ </subsection>
125
+
126
+ <subsection name="ZipArchiveOutputStream" id="ZipArchiveOutputStream">
127
+ <p><code>ZipArchiveOutputStream</code> has four constructors,
128
+ two of them uses a <code>File</code> argument, one a
129
+ <code>SeekableByteChannel</code> and the last uses an
130
+ <code>OutputStream</code>.</p>
131
+
132
+ <p>The constructor accepting a <code>File</code> and a size is
133
+ used exclusively for creating a split ZIP archive and is
134
+ described in the next section. For the remainder of this
135
+ section this constructor is equivalent to the one using the
136
+ <code>OutputStream</code> argument and thus it is not possible
137
+ to add uncompressed entries of unknown size.</p>
138
+
139
+ <p>Of the remaining three constructors the <code>File</code> version will
140
+ try to use <code>SeekableByteChannel</code> and fall back to
141
+ using a <code>FileOutputStream</code> internally if that
142
+ fails.</p>
143
+
144
+ <p>If <code>ZipArchiveOutputStream</code> can
145
+ use <code>SeekableByteChannel</code> it can employ some
146
+ optimizations that lead to smaller archives. It also makes
147
+ it possible to add uncompressed (<code>setMethod</code> used
148
+ with <code>STORED</code>) entries of unknown size when
149
+ calling <code>putArchiveEntry</code> - this is not allowed
150
+ if <code>ZipArchiveOutputStream</code> has to use
151
+ an <code>OutputStream</code>.</p>
152
+
153
+ <p>If you know you are writing to a file, you should always
154
+ prefer the <code>File</code>- or
155
+ <code>SeekableByteChannel</code>-arg constructors. The class
156
+ <code>org.apache.commons.compress.utils.SeekableInMemoryByteChannel</code>
157
+ allows you to write to an in-memory archive.</p>
158
+
159
+ </subsection>
160
+
161
+ <subsection name="Multi Volume Archives">
162
+ <p>The ZIP format knows so called split and spanned
163
+ archives. Spanned archives cross several removable media and
164
+ are not supported by Commons Compress.</p>
165
+
166
+ <p>Split archives consist of multiple files that reside in the
167
+ same directory with the same base name (the file name without
168
+ the file extension). The last file of the archive has the
169
+ extension <code>zip</code> the remaining files conventionally
170
+ use extensions <code>z01</code>, <code>z02</code> and so
171
+ on. Support for splitted archives has been added with Compress
172
+ 1.20.</p>
173
+
174
+ <p>If you want to create a split ZIP archive you use the
175
+ constructor of <code>ZipArchiveOutputStream</code> that
176
+ accepts a <code>File</code> argument and a size. The size
177
+ determines the maximum size of a split segment - the size must
178
+ be between 64kB and 4GB. While creating the archive, this will
179
+ create several files following the naming convention described
180
+ above. The name of the <code>File</code> argument used inside
181
+ of the constructor must use the extension
182
+ <code>zip</code>.</p>
183
+
184
+ <p>It is currently not possible to write split archives with
185
+ more than 64k segments. When creating split archives with more
186
+ than 100 segments you will need to adjust the file names as
187
+ <code>ZipArchiveOutputStream</code> assumes extensions will be
188
+ three characters long.</p>
189
+
190
+ <p>If you want to read a split archive you must create a
191
+ <code>ZipSplitReadOnlySeekableByteChannel</code> from the
192
+ parts. Both <code>ZipFile</code> and
193
+ <code>ZipArchiveInputStream</code> support reading streams of
194
+ this type, in the case of <code>ZipArchiveInputStream</code>
195
+ you need to use a constructor where you can set
196
+ <code>skipSplitSig</code> to true.</p>
197
+ </subsection>
198
+
199
+ <subsection name="Extra Fields">
200
+
201
+ <p>Inside a ZIP archive, additional data can be attached to
202
+ each entry. The <code>java.util.zip.ZipEntry</code> class
203
+ provides access to this via the <code>get/setExtra</code>
204
+ methods as arrays of <code>byte</code>s.</p>
205
+
206
+ <p>Actually the extra data is supposed to be more structured
207
+ than that and Compress' ZIP package provides access to the
208
+ structured data as <code>ZipExtraField</code> instances. Only
209
+ a subset of all defined extra field formats is supported by
210
+ the package, any other extra field will be stored
211
+ as <code>UnrecognizedExtraField</code>.</p>
212
+
213
+ <p>Prior to version 1.1 of this library trying to read an
214
+ archive with extra fields that didn't follow the recommended
215
+ structure for those fields would cause Compress to throw an
216
+ exception. Starting with version 1.1 these extra fields
217
+ will now be read
218
+ as <code>UnparseableExtraFieldData</code>.</p>
219
+
220
+ <p>Prior to version 1.19 of this library trying to read an
221
+ archive with extra fields that Compress expects to
222
+ understand but that used a different content than expected
223
+ would cause Compress to throw an exception. Starting with
224
+ version 1.19 these extra fields will now be read as
225
+ <code>UnrecognizedExtraField</code>. Using
226
+ <code>ZipArchiveEntry.getExtraFields(ExtraFieldParsingBehavior)</code>
227
+ you have a more fine grained control over the parser.</p>
228
+
229
+ </subsection>
230
+
231
+ <subsection name="Encoding" id="encoding">
232
+
233
+ <p>Traditionally the ZIP archive format uses CodePage 437 as
234
+ encoding for file name, which is not sufficient for many
235
+ international character sets.</p>
236
+
237
+ <p>Over time different archivers have chosen different ways to
238
+ work around the limitation - the <code>java.util.zip</code>
239
+ packages simply uses UTF-8 as its encoding for example.</p>
240
+
241
+ <p>Ant has been offering the encoding attribute of the zip and
242
+ unzip task as a way to explicitly specify the encoding to
243
+ use (or expect) since Ant 1.4. It defaults to the
244
+ platform's default encoding for zip and UTF-8 for jar and
245
+ other jar-like tasks (war, ear, ...) as well as the unzip
246
+ family of tasks.</p>
247
+
248
+ <p>More recent versions of the ZIP specification introduce
249
+ something called the &quot;language encoding flag&quot;
250
+ which can be used to signal that a file name has been
251
+ encoded using UTF-8. All ZIP-archives written by Compress
252
+ will set this flag, if the encoding has been set to UTF-8.
253
+ Our interoperability tests with existing archivers didn't
254
+ show any ill effects (in fact, most archivers ignore the
255
+ flag to date), but you can turn off the "language encoding
256
+ flag" by setting the attribute
257
+ <code>useLanguageEncodingFlag</code> to <code>false</code> on the
258
+ <code>ZipArchiveOutputStream</code> if you should encounter
259
+ problems.</p>
260
+
261
+ <p>The <code>ZipFile</code>
262
+ and <code>ZipArchiveInputStream</code> classes will
263
+ recognize the language encoding flag and ignore the encoding
264
+ set in the constructor if it has been found.</p>
265
+
266
+ <p>The InfoZIP developers have introduced new ZIP extra fields
267
+ that can be used to add an additional UTF-8 encoded file
268
+ name to the entry's metadata. Most archivers ignore these
269
+ extra fields. <code>ZipArchiveOutputStream</code> supports
270
+ an option <code>createUnicodeExtraFields</code> which makes
271
+ it write these extra fields either for all entries
272
+ ("always") or only those whose name cannot be encoded using
273
+ the specified encoding (not-encodable), it defaults to
274
+ "never" since the extra fields create bigger archives.</p>
275
+
276
+ <p>The fallbackToUTF8 attribute
277
+ of <code>ZipArchiveOutputStream</code> can be used to create
278
+ archives that use the specified encoding in the majority of
279
+ cases but UTF-8 and the language encoding flag for filenames
280
+ that cannot be encoded using the specified encoding.</p>
281
+
282
+ <p>The <code>ZipFile</code>
283
+ and <code>ZipArchiveInputStream</code> classes recognize the
284
+ Unicode extra fields by default and read the file name
285
+ information from them, unless you set the constructor parameter
286
+ <code>scanForUnicodeExtraFields</code> to false.</p>
287
+
288
+ <h4>Recommendations for Interoperability</h4>
289
+
290
+ <p>The optimal setting of flags depends on the archivers you
291
+ expect as consumers/producers of the ZIP archives. Below
292
+ are some test results which may be superseded with later
293
+ versions of each tool.</p>
294
+
295
+ <ul>
296
+ <li>The java.util.zip package used by the jar executable or
297
+ to read jars from your CLASSPATH reads and writes UTF-8
298
+ names, it doesn't set or recognize any flags or Unicode
299
+ extra fields.</li>
300
+
301
+ <li>Starting with Java7 <code>java.util.zip</code> writes
302
+ UTF-8 by default and uses the language encoding flag. It
303
+ is possible to specify a different encoding when
304
+ reading/writing ZIPs via new constructors. The package
305
+ now recognizes the language encoding flag when reading and
306
+ ignores the Unicode extra fields.</li>
307
+
308
+ <li>7Zip writes CodePage 437 by default but uses UTF-8 and
309
+ the language encoding flag when writing entries that
310
+ cannot be encoded as CodePage 437 (similar to the zip task
311
+ with fallbacktoUTF8 set to true). It recognizes the
312
+ language encoding flag when reading and ignores the
313
+ Unicode extra fields.</li>
314
+
315
+ <li>WinZIP writes CodePage 437 and uses Unicode extra fields
316
+ by default. It recognizes the Unicode extra field and the
317
+ language encoding flag when reading.</li>
318
+
319
+ <li>Windows' "compressed folder" feature doesn't recognize
320
+ any flag or extra field and creates archives using the
321
+ platforms default encoding - and expects archives to be in
322
+ that encoding when reading them.</li>
323
+
324
+ <li>InfoZIP based tools can recognize and write both, it is
325
+ a compile time option and depends on the platform so your
326
+ mileage may vary.</li>
327
+
328
+ <li>PKWARE zip tools recognize both and prefer the language
329
+ encoding flag. They create archives using CodePage 437 if
330
+ possible and UTF-8 plus the language encoding flag for
331
+ file names that cannot be encoded as CodePage 437.</li>
332
+ </ul>
333
+
334
+ <p>So, what to do?</p>
335
+
336
+ <p>If you are creating jars, then java.util.zip is your main
337
+ consumer. We recommend you set the encoding to UTF-8 and
338
+ keep the language encoding flag enabled. The flag won't
339
+ help or hurt java.util.zip prior to Java7 but archivers that
340
+ support it will show the correct file names.</p>
341
+
342
+ <p>For maximum interop it is probably best to set the encoding
343
+ to UTF-8, enable the language encoding flag and create
344
+ Unicode extra fields when writing ZIPs. Such archives
345
+ should be extracted correctly by java.util.zip, 7Zip,
346
+ WinZIP, PKWARE tools and most likely InfoZIP tools. They
347
+ will be unusable with Windows' "compressed folders" feature
348
+ and bigger than archives without the Unicode extra fields,
349
+ though.</p>
350
+
351
+ <p>If Windows' "compressed folders" is your primary consumer,
352
+ then your best option is to explicitly set the encoding to
353
+ the target platform. You may want to enable creation of
354
+ Unicode extra fields so the tools that support them will
355
+ extract the file names correctly.</p>
356
+ </subsection>
357
+
358
+ <subsection name="Encryption and Alternative Compression Algorithms"
359
+ id="encryption">
360
+
361
+ <p>In most cases entries of an archive are not encrypted and
362
+ are either not compressed at all or use the DEFLATE
363
+ algorithm, Commons Compress' ZIP archiver will handle them
364
+ just fine. As of version 1.7, Commons Compress can also
365
+ decompress entries compressed with the legacy SHRINK and
366
+ IMPLODE algorithms of PKZIP 1.x. Version 1.11 of Commons
367
+ Compress adds read-only support for BZIP2. Version 1.16 adds
368
+ read-only support for DEFLATE64 - also known as "enhanced DEFLATE".</p>
369
+
370
+ <p>The ZIP specification allows for various other compression
371
+ algorithms and also supports several different ways of
372
+ encrypting archive contents. Neither of those methods is
373
+ currently supported by Commons Compress and any such entry can
374
+ not be extracted by the archiving code.</p>
375
+
376
+ <p><code>ZipFile</code>'s and
377
+ <code>ZipArchiveInputStream</code>'s
378
+ <code>canReadEntryData</code> methods will return false for
379
+ encrypted entries or entries using an unsupported encryption
380
+ mechanism. Using this method it is possible to at least
381
+ detect and skip the entries that can not be extracted.</p>
382
+
383
+ <table>
384
+ <thead>
385
+ <tr>
386
+ <th>Version of Apache Commons Compress</th>
387
+ <th>Supported Compression Methods</th>
388
+ <th>Supported Encryption Methods</th>
389
+ </tr>
390
+ </thead>
391
+ <tbody>
392
+ <tr>
393
+ <td>1.0 to 1.6</td>
394
+ <td>STORED, DEFLATE</td>
395
+ <td>-</td>
396
+ </tr>
397
+ <tr>
398
+ <td>1.7 to 1.10</td>
399
+ <td>STORED, DEFLATE, SHRINK, IMPLODE</td>
400
+ <td>-</td>
401
+ </tr>
402
+ <tr>
403
+ <td>1.11 to 1.15</td>
404
+ <td>STORED, DEFLATE, SHRINK, IMPLODE, BZIP2</td>
405
+ <td>-</td>
406
+ </tr>
407
+ <tr>
408
+ <td>1.16 and later</td>
409
+ <td>STORED, DEFLATE, SHRINK, IMPLODE, BZIP2, DEFLATE64
410
+ (enhanced deflate)</td>
411
+ <td>-</td>
412
+ </tr>
413
+ </tbody>
414
+ </table>
415
+
416
+ </subsection>
417
+
418
+ <subsection name="Zip64 Support" id="zip64">
419
+ <p>The traditional ZIP format is limited to archive sizes of
420
+ four gibibyte (actually 2<sup>32</sup> - 1 bytes &#x2248;
421
+ 4.3 GB) and 65635 entries, where each individual entry is
422
+ limited to four gibibyte as well. These limits seemed
423
+ excessive in the 1980s.</p>
424
+
425
+ <p>Version 4.5 of the ZIP specification introduced the so
426
+ called "Zip64 extensions" to push those limitations for
427
+ compressed or uncompressed sizes of up to 16 exbibyte
428
+ (actually 2<sup>64</sup> - 1 bytes &#x2248; 18.5 EB, i.e
429
+ 18.5 x 10<sup>18</sup> bytes) in archives that themselves
430
+ can take up to 16 exbibyte containing more than
431
+ 18 x 10<sup>18</sup> entries.</p>
432
+
433
+ <p>Apache Commons Compress 1.2 and earlier do not support
434
+ Zip64 extensions at all.</p>
435
+
436
+ <p>Starting with Apache Commons Compress
437
+ 1.3 <code>ZipArchiveInputStream</code>
438
+ and <code>ZipFile</code> transparently support Zip64
439
+ extensions. By default <code>ZipArchiveOutputStream</code>
440
+ supports them transparently as well (i.e. it adds Zip64
441
+ extensions if needed and doesn't use them for
442
+ entries/archives that don't need them) if the compressed and
443
+ uncompressed sizes of the entry are known
444
+ when <code>putArchiveEntry</code> is called
445
+ or <code>ZipArchiveOutputStream</code>
446
+ uses <code>SeekableByteChannel</code>
447
+ (see <a href="#ZipArchiveOutputStream">above</a>). If only
448
+ the uncompressed size is
449
+ known <code>ZipArchiveOutputStream</code> will assume the
450
+ compressed size will not be bigger than the uncompressed
451
+ size.</p>
452
+
453
+ <p><code>ZipArchiveOutputStream</code>'s
454
+ <code>setUseZip64</code> can be used to control the behavior.
455
+ <code>Zip64Mode.AsNeeded</code> is the default behavior
456
+ described in the previous paragraph.</p>
457
+
458
+ <p>If <code>ZipArchiveOutputStream</code> is writing to a
459
+ non-seekable stream it has to decide whether to use Zip64
460
+ extensions or not before it starts writing the entry data.
461
+ This means that if the size of the entry is unknown
462
+ when <code>putArchiveEntry</code> is called it doesn't have
463
+ anything to base the decision on. By default it will not
464
+ use Zip64 extensions in order to create archives that can be
465
+ extracted by older archivers (it will later throw an
466
+ exception in <code>closeEntry</code> if it detects Zip64
467
+ extensions had been needed). It is possible to
468
+ instruct <code>ZipArchiveOutputStream</code> to always
469
+ create Zip64 extensions by using
470
+ the <code>setUseZip64</code> with an argument
471
+ of <code>Zip64Mode.Always</code>; use this if you are
472
+ writing entries of unknown size to a stream and expect some
473
+ of them to be too big to fit into the traditional
474
+ limits.</p>
475
+
476
+ <p><code>Zip64Mode.Always</code> creates archives that use
477
+ Zip64 extensions for all entries, even those that don't
478
+ require them. Such archives will be slightly bigger than
479
+ archives created with one of the other modes and not be
480
+ readable by unarchivers that don't support Zip64
481
+ extensions.</p>
482
+
483
+ <p><code>Zip64Mode.Never</code> will not use any Zip64
484
+ extensions at all and may lead to
485
+ a <code>Zip64RequiredException</code> to be thrown
486
+ if <code>ZipArchiveOutputStream</code> detects that one of
487
+ the format's limits is exceeded. Archives created in this
488
+ mode will be readable by all unarchivers; they may be
489
+ slightly smaller than archives created
490
+ with <code>SeekableByteChannel</code>
491
+ in <code>Zip64Mode.AsNeeded</code> mode if some of the
492
+ entries had unknown sizes.</p>
493
+
494
+ <p>The <code>java.util.zip</code> package and the
495
+ <code>jar</code> command of Java5 and earlier can not read
496
+ Zip64 extensions and will fail if the archive contains any.
497
+ So if you intend to create archives that Java5 can consume
498
+ you must set the mode to <code>Zip64Mode.Never</code></p>
499
+
500
+ <h4>Known Limitations</h4>
501
+
502
+ <p>Some of the theoretical limits of the format are not
503
+ reached because Apache Commons Compress' own API
504
+ (<code>ArchiveEntry</code>'s size information uses
505
+ a <code>long</code>) or its usage of Java collections
506
+ or <code>SeekableByteChannel</code> internally. The table
507
+ below shows the theoretical limits supported by Apache
508
+ Commons Compress. In practice it is very likely that you'd
509
+ run out of memory or your file system won't allow files that
510
+ big long before you reach either limit.</p>
511
+
512
+ <table>
513
+ <thead>
514
+ <tr>
515
+ <th/>
516
+ <th>Max. Size of Archive</th>
517
+ <th>Max. Compressed/Uncompressed Size of Entry</th>
518
+ <th>Max. Number of Entries</th>
519
+ </tr>
520
+ </thead>
521
+ <tbody>
522
+ <tr>
523
+ <td>ZIP Format Without Zip 64 Extensions</td>
524
+ <td>2<sup>32</sup> - 1 bytes &#x2248; 4.3 GB</td>
525
+ <td>2<sup>32</sup> - 1 bytes &#x2248; 4.3 GB</td>
526
+ <td>65535</td>
527
+ </tr>
528
+ <tr>
529
+ <td>ZIP Format using Zip 64 Extensions</td>
530
+ <td>2<sup>64</sup> - 1 bytes &#x2248; 18.5 EB</td>
531
+ <td>2<sup>64</sup> - 1 bytes &#x2248; 18.5 EB</td>
532
+ <td>2<sup>64</sup> - 1 &#x2248; 18.5 x 10<sup>18</sup></td>
533
+ </tr>
534
+ <tr>
535
+ <td>Commons Compress 1.2 and earlier</td>
536
+ <td>unlimited in <code>ZipArchiveInputStream</code>
537
+ and <code>ZipArchiveOutputStream</code> and
538
+ 2<sup>32</sup> - 1 bytes &#x2248; 4.3 GB
539
+ in <code>ZipFile</code>.</td>
540
+ <td>2<sup>32</sup> - 1 bytes &#x2248; 4.3 GB</td>
541
+ <td>unlimited in <code>ZipArchiveInputStream</code>,
542
+ 65535 in <code>ZipArchiveOutputStream</code>
543
+ and <code>ZipFile</code>.</td>
544
+ </tr>
545
+ <tr>
546
+ <td>Commons Compress 1.3 and later</td>
547
+ <td>unlimited in <code>ZipArchiveInputStream</code>
548
+ and <code>ZipArchiveOutputStream</code> and
549
+ 2<sup>63</sup> - 1 bytes &#x2248; 9.2 EB
550
+ in <code>ZipFile</code>.</td>
551
+ <td>2<sup>63</sup> - 1 bytes &#x2248; 9.2 EB</td>
552
+ <td>unlimited in <code>ZipArchiveInputStream</code>,
553
+ 2<sup>31</sup> - 1 &#x2248; 2.1 billion
554
+ in <code>ZipArchiveOutputStream</code>
555
+ and <code>ZipFile</code>.</td>
556
+ </tr>
557
+ </tbody>
558
+ </table>
559
+
560
+ <h4>Known Interoperability Problems</h4>
561
+
562
+ <p>The <code>java.util.zip</code> package of OpenJDK7 supports
563
+ Zip 64 extensions but its <code>ZipInputStream</code> and
564
+ <code>ZipFile</code> classes will be unable to extract
565
+ archives created with Commons Compress 1.3's
566
+ <code>ZipArchiveOutputStream</code> if the archive contains
567
+ entries that use the data descriptor, are smaller than 4 GiB
568
+ and have Zip 64 extensions enabled. I.e. the classes in
569
+ OpenJDK currently only support archives that use Zip 64
570
+ extensions only when they are actually needed. These classes
571
+ are used to load JAR files and are the base for the
572
+ <code>jar</code> command line utility as well.</p>
573
+ </subsection>
574
+
575
+ <subsection name="Consuming Archives Completely">
576
+
577
+ <p>Prior to version 1.5 <code>ZipArchiveInputStream</code>
578
+ would return null from <code>getNextEntry</code> or
579
+ <code>getNextZipEntry</code> as soon as the first central
580
+ directory header of the archive was found, leaving the whole
581
+ central directory itself unread inside the stream. Starting
582
+ with version 1.5 <code>ZipArchiveInputStream</code> will try
583
+ to read the archive up to and including the "end of central
584
+ directory" record effectively consuming the archive
585
+ completely.</p>
586
+
587
+ </subsection>
588
+
589
+ <subsection name="Symbolic Links" id="symlinks">
590
+
591
+ <p>Starting with Compress 1.5 <code>ZipArchiveEntry</code>
592
+ recognizes Unix Symbolic Link entries written by InfoZIP's
593
+ zip.</p>
594
+
595
+ <p>The <code>ZipFile</code> class contains a convenience
596
+ method to read the link name of an entry. Basically all it
597
+ does is read the contents of the entry and convert it to
598
+ a string using the given file name encoding of the
599
+ archive.</p>
600
+
601
+ </subsection>
602
+
603
+ <subsection name="Parallel zip creation" id="parallel">
604
+
605
+ <p>Starting with Compress 1.10 there is now built-in support for
606
+ parallel creation of zip archives</p>
607
+
608
+ <p>Multiple threads can write
609
+ to their own <code>ScatterZipOutputStream</code>
610
+ instance that is backed to file or to some user-implemented form of
611
+ storage (implementing <code>ScatterGatherBackingStore</code>).</p>
612
+
613
+ <p>When the threads finish, they can join these streams together
614
+ to a complete zip file using the <code>writeTo</code> method
615
+ that will write a single <code>ScatterOutputStream</code> to a target
616
+ <code>ZipArchiveOutputStream</code>.</p>
617
+
618
+ <p>To assist this process, clients can use
619
+ <code>ParallelScatterZipCreator</code> that will handle threads
620
+ pools and correct memory model consistency so the client
621
+ can avoid these issues.</p>
622
+
623
+ <p>Until version 1.18, there was no guarantee of order of the entries when writing a Zip
624
+ file with <code>ParallelScatterZipCreator</code>. In consequence, when writing well-formed
625
+ Zip files this way, it was usually necessary to keep a
626
+ separate <code>ScatterZipOutputStream</code> that received all directories
627
+ and wrote this to the target <code>ZipArchiveOutputStream</code> before
628
+ the ones created through <code>ParallelScatterZipCreator</code>. This was the responsibility of the client.</p>
629
+
630
+ <p>Starting with version 1.19, entries order is kept, then this specific handling of directories is not
631
+ necessary any more.</p>
632
+
633
+ <p>
634
+ See the examples section for a code sample demonstrating how to make a zip file.
635
+ </p>
636
+ </subsection>
637
+ <subsection name="Zstandard Support" id="zstd">
638
+ <p>
639
+ Starting with Compress 1.28.0, <code>org.apache.commons.compress.archivers.zip</code> supports reading and writing using the Zstandard method.
640
+ Zstandard method <code>93</code> and the deprecated <code>20</code> are supported.
641
+ </p>
642
+ </subsection>
643
+ </section>
644
+ </body>
645
+ </document>
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/COMPRESS-379.jar ADDED
Binary file (222 Bytes). View file
 
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/COMPRESS-382 ADDED
Binary file (19 Bytes). View file
 
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/COMPRESS-386 ADDED
@@ -0,0 +1 @@
 
 
1
+ �B
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/bla-multi.7z.001 ADDED
Binary file (512 Bytes). View file
 
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/bla.pack ADDED
Binary file (1.65 kB). View file
 
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/bla.unix.arj ADDED
Binary file (257 Bytes). View file
 
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/longfile_bsd.ar ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ !<arch>
2
+ #1/28 1311256511 1000 1000 100644 42 `
3
+ this_is_a_long_file_name.txtHello, world!
4
+ #1/36 1454694016 1000 1000 100664 40 `
5
+ this_is_a_long_file_name_as_well.txtBye
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/longfile_gnu.ar ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ !<arch>
2
+ // 68 `
3
+ this_is_a_long_file_name.txt/
4
+ this_is_a_long_file_name_as_well.txt/
5
+ /0 1454693980 1000 1000 100664 14 `
6
+ Hello, world!
7
+ /30 1454694016 1000 1000 100664 4 `
8
+ Bye
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/test with spaces.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ TEST WITH SPACES IN FILENAME
2
+ 111111111111111111111111111000101011
3
+ 111111111111111111111111111000101011
4
+ 111111111111111111111111111000101011
5
+ 111111111111111111111111111000101011
6
+ 111111111111111111111111111000101011
7
+ 111111111111111111111111111000101011
8
+ 111111111111111111111111111000101011
9
+ 111111111111111111111111111000101011
10
+ 111111111111111111111111111000101011
11
+ 111111111111111111111111111000101011
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/test1.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <?xml version = '1.0'?>
2
+ <!DOCTYPE connections>
3
+ <connections>
4
+ </connections>
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/test3.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version = '1.0'?>
2
+ <!DOCTYPE connections>
3
+ <text>
4
+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
5
+ sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
6
+ sed diam voluptua.
7
+ At vero eos et accusam et justo duo dolores et ea rebum.
8
+ Stet clita kasd gubergren, no sea takimata sanctus est
9
+ Lorem ipsum dolor sit amet.
10
+ </text>
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/test4.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version = '1.0'?>
2
+ <!DOCTYPE connections>
3
+ <connections>
4
+ German Umlauts: ÜÄÖß
5
+ Stored as UTF-8 (Mac OSX 10.4.x)
6
+ </connections>
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/testAIFF.aif ADDED
Binary file (3.89 kB). View file
 
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/zipbomb.xlsx ADDED
Binary file (18.3 kB). View file